Added 'lexer' file test
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
# (c) 2018 Jan Lerking
|
||||
# Python lexer for c header files.
|
||||
# Used for creating corresponding NASM include files.
|
||||
|
||||
import keywords
|
||||
import os
|
||||
|
||||
keywords.init()
|
||||
|
||||
lexed_line = []
|
||||
|
||||
def lex_line(l):
|
||||
prep = keywords.preprocessor_directives
|
||||
reg = keywords.regular
|
||||
for w in l:
|
||||
if w in prep:
|
||||
lexed_line.append(prep(w))
|
||||
lexed_line.append(w)
|
||||
break
|
||||
if w in reg:
|
||||
lexed_line.append(reg(w))
|
||||
lexed_line.append(w)
|
||||
Reference in New Issue
Block a user