keywords.py updated

This commit is contained in:
2018-08-11 09:51:08 +02:00
parent 44d8671ea2
commit 872ce09dee

View File

@@ -1,11 +1,11 @@
# (c) 2018 Jan Lerking ## (c) 2018 Jan Lerking
# Python lexer for c header files. ## Python lexer for c header files.
# Used for creating corresponding NASM include files. ## Used for creating corresponding NASM include files.
# Contains tokens expanded with reserved 'C' keywords ## Contains tokens expanded with reserved 'C' keywords
def init(): def init():
global tokens global TOKENS
tokens = [ TOKENS = [
'CSTART', 'CSTART',
'CMID', 'CMID',
'CEND', 'CEND',
@@ -30,7 +30,7 @@ def init():
'POINTER' 'POINTER'
] ]
reserved = { RESERVED = {
'auto' : 'AUTO', 'auto' : 'AUTO',
'break' : 'BREAK', 'break' : 'BREAK',
'case' : 'CASE', 'case' : 'CASE',
@@ -65,8 +65,8 @@ def init():
'if' : 'IF' 'if' : 'IF'
} }
global preprocessor_directives global PREPROCESSOR_DIRECTIVES
preprocessor_directives = { PREPROCESSOR_DIRECTIVES = {
'#include' : 'PREPROCESS', '#include' : 'PREPROCESS',
'#define' : 'PREPROCESS', '#define' : 'PREPROCESS',
'#undef' : 'PREPROCESS', '#undef' : 'PREPROCESS',
@@ -84,8 +84,8 @@ def init():
'##' : 'PREPROCESS' '##' : 'PREPROCESS'
} }
global regular global REGULAR
regular = { REGULAR = {
'/*' : 'CSTART', '/*' : 'CSTART',
'*/' : 'CEND', '*/' : 'CEND',
'=' : 'ASSIGN', '=' : 'ASSIGN',
@@ -104,8 +104,8 @@ def init():
'\>' : 'RANGLE' '\>' : 'RANGLE'
} }
global nasm_preprocess_directives global NASM_PREPROCESS_DIRECTIVES
nasm_preprocess_directives = { NASM_PREPROCESS_DIRECTIVES = {
'#include' : '$include', '#include' : '$include',
'#define' : '$define', '#define' : '$define',
'#undef' : '$undef', '#undef' : '$undef',
@@ -123,4 +123,4 @@ def init():
'##' : '##' '##' : '##'
} }
tokens += reserved.values() TOKENS += RESERVED.values()