yml2.py
changeset 23 f2e8837da4e9
parent 20 c936066cff62
child 25 cb4a7f8b230d
child 28 e9a51b1d5587
equal deleted inserted replaced
22:3a2bd70c01df 23:f2e8837da4e9
     1 # YML 2.5.8 language definition
     1 # YML 2.5.9 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
    75 def python():       return [r(r"!!.*?!!", re.S), r(r"!.*")]
    75 def python():       return [r(r"!!.*?!!", re.S), r(r"!.*")]
    76 def operator():     return 0, keyword("define"), keyword("operator"), literal, keyword("as"), r(r".*")
    76 def operator():     return 0, keyword("define"), keyword("operator"), literal, keyword("as"), r(r".*")
    77 def constant():     return 0, keyword("define"), [pointer, symbol], "=", literal, 0, [";", "."]
    77 def constant():     return 0, keyword("define"), [pointer, symbol], "=", literal, 0, [";", "."]
    78 def in_ns():        return keyword("in"), xmlSymbol, [_decl, ("{", -2, _decl, "}")]
    78 def in_ns():        return keyword("in"), xmlSymbol, [_decl, ("{", -2, _decl, "}")]
    79 _decl = keyword("decl"), listing(decl), [";", "."]
    79 _decl = keyword("decl"), listing(decl), [";", "."]
    80 def textsection():  return r(r'(\|\|(\>*).*?\|\|(\>*))', re.S)
    80 def textsection():  return r(r'(\|\|(\>*)(.*?)\|\|(\>*))\s*$', re.S | re.M)
    81 def textsectionu(): return r(r'(\>\>.*?\>\>)', re.S)
    81 def textsectionu(): return r(r'(\>\>.*?\>\>)', re.S)
    82 def include():      return keyword("include"), 0, reverse, 0, [ktext, kxml], filename, 0, [";", "."]
    82 def include():      return keyword("include"), 0, reverse, 0, [ktext, kxml], filename, 0, [";", "."]
    83 def func():         return _func, 0, content
    83 def func():         return _func, 0, content
    84 def funclist():     return listing(func)
    84 def funclist():     return listing(func)
    85 _cmd = funclist, 0, [";", "."]
    85 _cmd = funclist, 0, [";", "."]