diff options
author | Sunil Shetye | 2018-06-15 00:48:55 +0530 |
---|---|---|
committer | Sunil Shetye | 2018-06-15 16:22:12 +0530 |
commit | be9f32c23ef04b74ad1b07a09f0663015dc98993 (patch) | |
tree | a8d8b3ad7a01e93d72a791d59e78e09443bef5ae /sci2jslex.py | |
parent | 637774bd20563d502442fca84ee862b560b7b6dd (diff) | |
download | sci2js-be9f32c23ef04b74ad1b07a09f0663015dc98993.tar.gz sci2js-be9f32c23ef04b74ad1b07a09f0663015dc98993.tar.bz2 sci2js-be9f32c23ef04b74ad1b07a09f0663015dc98993.zip |
identify the job blocks
Diffstat (limited to 'sci2jslex.py')
-rwxr-xr-x | sci2jslex.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sci2jslex.py b/sci2jslex.py index bb8e945d..74f0ef0d 100755 --- a/sci2jslex.py +++ b/sci2jslex.py @@ -1,5 +1,7 @@ #!/usr/bin/python +from __future__ import print_function + import ply.lex as lex import sys @@ -23,6 +25,8 @@ syntaxtokens = { 'for': 'FOR', 'function': 'FUNCTION', 'if': 'IF', + 'in': 'IN', + 'job': 'JOB', 'part': 'PART', 'resume': 'RESUME', 'return': 'RETURN', @@ -251,7 +255,7 @@ def t_COLON(t): return t def t_error(t): - print("Illegal character '%s'" % t.value[0]) + print("Illegal character '", t.value[0], "'", sep='') t.lexer.skip(1) def t_TRANSPOSE(t): @@ -317,18 +321,18 @@ def t_dqstring_end(t): return t def t_qstring_error(t): - print("Illegal character '%s' in qstring" % t.value[0]) + print("Illegal character '", t.value[0], "' in qstring", sep='') t.lexer.skip(1) def t_dqstring_error(t): - print("Illegal character '%s' in dqstring" % t.value[0]) + print("Illegal character '", t.value[0], "' in dqstring", sep='') t.lexer.skip(1) lexer = lex.lex() if __name__ == '__main__': if len(sys.argv) <= 1: - print("Usage: %s filename" % sys.argv[0]) + print('Usage:', sys.argv[0], 'filename') sys.exit(1) filename = sys.argv[1] |