def lexer(term):
return re.findall('"[^"]*"' # string
+ "|'[^']+'" # quoted functor
'|[a-z][a-zA-Z_0-9]*' # functor
- '|[A-Z_][a-zA-Z0-9_]*' # variable
- '|[(), \[\]|]+' # parens and comma
+ '|[A-Z_][a-zA-Z0-9_]*' # variable
+ '|[(), \[\]|:]+' # parens and comma
'|[^(), ]+', term) # everything else
, ("with_key" ,[(4,PFIn AssocNone ) ])
, ("->" ,[(5,PFIn AssocNone ) ])
+ , (":" ,[(5,PFIn AssocRight ) ])
, ("<=" ,[(4,PFIn AssocNone ) ])
, ("<" ,[(4,PFIn AssocNone ) ])
, (("nil", 0),(SDQuote,[]))
, (("cons", 2),(SDQuote,[ADEval,ADEval]))
, (("->",2),(SDQuote,[ADQuote, ADQuote]))
+ , ((":",2),(SDQuote,[ADQuote, ADQuote]))
]
-- | Make the default surface syntax more functional. Here, all functors
, (("$key" ,1),(SDEval,[ADQuote]))
, (("with_key",2),(SDQuote,[ADEval, ADEval]))
, (("->",2),(SDQuote,[ADQuote, ADQuote]))
+ , ((":",2),(SDQuote,[ADQuote, ADQuote]))
+
]
------------------------------------------------------------------------}}}