yml2.py
changeset 20 c936066cff62
parent 14 d937e9d7c4fe
child 23 f2e8837da4e9
equal deleted inserted replaced
19:8903f9e692b9 20:c936066cff62
     1 # YML 2.5.6 language definition
     1 # YML 2.5.8 language definition
     2 
     2 
     3 # written by VB.
     3 # written by VB.
     4 
     4 
     5 import re
     5 import re
     6 from pyPEG import keyword, _and, _not
     6 from pyPEG import keyword, _and, _not
    64 def parm():         return [([xmlSymbol, pyExp, pointer, macro], "=", [value, pointer, symbol]), value, pointer]
    64 def parm():         return [([xmlSymbol, pyExp, pointer, macro], "=", [value, pointer, symbol]), value, pointer]
    65 def parm_eq():      return [xmlSymbol, pyExp, pointer, macro], "=", [value, pointer, symbol]
    65 def parm_eq():      return [xmlSymbol, pyExp, pointer, macro], "=", [value, pointer, symbol]
    66 parm_eq.__name__ = "parm"
    66 parm_eq.__name__ = "parm"
    67 _func = [symbol, ppointer, pointer, reference], _if(newSyntax, (-1, ("[", listing(parm), "]"))), 0, ("(", listing(parm), ")"), 0, listing(parm), -1, parm_eq
    67 _func = [symbol, ppointer, pointer, reference], _if(newSyntax, (-1, ("[", listing(parm), "]"))), 0, ("(", listing(parm), ")"), 0, listing(parm), -1, parm_eq
    68 def pythonCall():   return keyword("python"), _func, [";", "."]
    68 def pythonCall():   return keyword("python"), _func, [";", "."]
    69 def declParm():     return [pointer, macro, xmlSymbol], 0, ("=", literal)
    69 def declParm():     return [pointer, macro, xmlSymbol], 0, ("=", [literal, symbol])
    70 def alias():        return keyword("alias"), aliasSymbol
    70 def alias():        return keyword("alias"), aliasSymbol
    71 def descend():      return r(r"[+@*]" + _symbol, re.U)
    71 def descend():      return r(r"[+@*]" + _symbol, re.U)
    72 def base():         return keyword("is"), symbol
    72 def base():         return keyword("is"), symbol
    73 def shape():        return symbol
    73 def shape():        return symbol
    74 def decl():         return symbol, 0, base, 0, ("<", listing(shape), ">"), -1, descend, _if(newSyntax, (-1, ("[", 0, listing(declParm), "]"))), 0, ("(", 0, listing(declParm), ")"), 0, alias, 0, content
    74 def decl():         return symbol, 0, base, 0, ("<", listing(shape), ">"), -1, descend, _if(newSyntax, (-1, ("[", 0, listing(declParm), "]"))), 0, ("(", 0, listing(declParm), ")"), 0, alias, 0, content