Add assertions to map and list items
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
from smnp.ast.node.iterable import abstractIterableParser
|
from smnp.ast.node.iterable import abstractIterableParser
|
||||||
from smnp.ast.node.model import Node
|
from smnp.ast.node.model import Node
|
||||||
|
from smnp.ast.parser import Parser
|
||||||
from smnp.token.type import TokenType
|
from smnp.token.type import TokenType
|
||||||
|
|
||||||
|
|
||||||
@@ -14,5 +15,5 @@ def ListParser(input):
|
|||||||
List,
|
List,
|
||||||
TokenType.OPEN_SQUARE,
|
TokenType.OPEN_SQUARE,
|
||||||
TokenType.CLOSE_SQUARE,
|
TokenType.CLOSE_SQUARE,
|
||||||
ExpressionParser
|
Parser.doAssert(ExpressionParser, "expression")
|
||||||
)(input)
|
)(input)
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ def MapParser(input):
|
|||||||
|
|
||||||
mapEntryParser = Parser.allOf(
|
mapEntryParser = Parser.allOf(
|
||||||
keyParser,
|
keyParser,
|
||||||
Parser.terminal(TokenType.ARROW, createNode=Operator.withValue),
|
Parser.terminal(TokenType.ARROW, createNode=Operator.withValue, doAssert=True),
|
||||||
valueParser,
|
Parser.doAssert(valueParser, "expression"),
|
||||||
createNode=MapEntry.withValues
|
createNode=MapEntry.withValues
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user