Esempio n. 1
0
 def test_string(self):
     self.assertTrue(STRING.load(""" "algo" """).value == "algo")
     self.assertTrue(
         STRING.load(""" "algo y algo" """).value == "algo y algo")
     self.assertTrue(
         STRING.load(""" "algo es \\"algo\\"" """).value ==
         '''algo es \\"algo\\"''')
     self.assertTrue(
         STRING.load(""" "algo es \\"algo\\"" """).unescape() ==
         '''algo es "algo"''')
Esempio n. 2
0
    syntax = delimitedList(Expression.names('expressions'), delim=","),
    )

ExpressionList.ebnf(
    syntax = delimitedList(Expression.names('expressions'), delim=","),
    )

ArraySubscripts.ebnf(
    syntax = Suppress("[") + delimitedList(Subscript.names('subscripts'), delim=",") + Suppress("]"),
    )

Subscript.ebnf(
    syntax = Suppress(":") ^ Expression.name("expression"),
    )

ComponentReference.ebnf(
    syntax = IDENT.name("identifier"),
    )

Comment.ebnf(
    syntax = StringComment.name("comment") + Optional(Annotation.name("annotation")),
    )

StringComment.ebnf(
    syntax = delimitedList(STRING.names('comments'), delim="+"),
    )

Annotation.ebnf(
    syntax = Literal("annotation") + ClassModification.name('modification'),
    )
Esempio n. 3
0
Expression.ebnf(syntax=IDENT.name("identifier"))

NamedArguments.ebnf(syntax=delimitedList(NamedArgument.names('arguments'),
                                         delim=","), )

NamedArgument.ebnf(syntax=IDENT.name('identifier') + Suppress("=") +
                   Expression.name('expression'), )

OutputExpressionList.ebnf(syntax=delimitedList(Expression.names('expressions'),
                                               delim=","), )

ExpressionList.ebnf(syntax=delimitedList(Expression.names('expressions'),
                                         delim=","), )

ArraySubscripts.ebnf(syntax=Suppress("[") +
                     delimitedList(Subscript.names('subscripts'), delim=",") +
                     Suppress("]"), )

Subscript.ebnf(syntax=Suppress(":") ^ Expression.name("expression"), )

ComponentReference.ebnf(syntax=IDENT.name("identifier"), )

Comment.ebnf(syntax=StringComment.name("comment") +
             Optional(Annotation.name("annotation")), )

StringComment.ebnf(syntax=delimitedList(STRING.names('comments'), delim="+"), )

Annotation.ebnf(syntax=Literal("annotation") +
                ClassModification.name('modification'), )
Esempio n. 4
0
 def test_string(self):
     self.assertTrue(STRING.load(""" "algo" """).value == "algo")
     self.assertTrue(STRING.load(""" "algo y algo" """).value == "algo y algo")
     self.assertTrue(STRING.load(""" "algo es \\"algo\\"" """).value == '''algo es \\"algo\\"''')
     self.assertTrue(STRING.load(""" "algo es \\"algo\\"" """).unescape() == '''algo es "algo"''')
Esempio n. 5
0
 def test_string(self):
     self.assertEqual(STRING("algo y algo").dump(), '''"algo y algo"''')