summaryrefslogtreecommitdiff
path: root/prolog/lexer.py
diff options
context:
space:
mode:
Diffstat (limited to 'prolog/lexer.py')
-rwxr-xr-xprolog/lexer.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/prolog/lexer.py b/prolog/lexer.py
index 008051c..971e8a6 100755
--- a/prolog/lexer.py
+++ b/prolog/lexer.py
@@ -62,6 +62,11 @@ t_UREAL = r'[0-9]+\.[0-9]+([eE][-+]?[0-9]+)?|inf|nan'
t_VARIABLE = r'(_|[A-Z])[a-zA-Z0-9_]*'
t_STRING = r'"(""|\\.|[^\"])*"'
+# no support for nested comments yet
+def t_comment(t):
+ r'(/\*(.|\n)*?\*/)|(%.*)'
+ pass
+
def t_NAME(t):
r"'(''|\\.|[^\\'])*'|[a-z][a-zA-Z0-9_]*|[-+*/\\^<>=~:.?@#$&]+|!|;|,"
if t.lexer.lexpos >= len(t.lexer.lexdata) or t.lexer.lexdata[t.lexer.lexpos] != '(':
@@ -70,11 +75,6 @@ def t_NAME(t):
t_ignore = ' \t'
-# no support for nested comments yet
-def t_comment(t):
- r'(/\*(.|\n)*?\*/)|(%.*)'
- pass
-
def t_newline(t):
r'\n+'
t.lexer.lineno += len(t.value)
@@ -88,5 +88,3 @@ def t_error(t):
return t
lexer = lex.lex()
-
-