Create a parser context
This commit is contained in:
@ -355,68 +355,65 @@ begin
|
||||
DEC(token^.identifierKind[1], lexer^.start.iterator);
|
||||
MemCopy(lexer^.start.iterator, ORD(token^.identifierKind[1]), ADR(token^.identifierKind[2]));
|
||||
|
||||
if compare_keyword('PROGRAM', lexer^.start, lexer^.current.iterator) then
|
||||
if compare_keyword('program', lexer^.start, lexer^.current.iterator) then
|
||||
token^.kind := lexerKindProgram
|
||||
end;
|
||||
if compare_keyword('IMPORT', lexer^.start, lexer^.current.iterator) then
|
||||
if compare_keyword('import', lexer^.start, lexer^.current.iterator) then
|
||||
token^.kind := lexerKindImport
|
||||
end;
|
||||
if compare_keyword('CONST', lexer^.start, lexer^.current.iterator) then
|
||||
if compare_keyword('const', lexer^.start, lexer^.current.iterator) then
|
||||
token^.kind := lexerKindConst
|
||||
end;
|
||||
if compare_keyword('VAR', lexer^.start, lexer^.current.iterator) then
|
||||
if compare_keyword('var', lexer^.start, lexer^.current.iterator) then
|
||||
token^.kind := lexerKindVar
|
||||
end;
|
||||
if compare_keyword('IF', lexer^.start, lexer^.current.iterator) then
|
||||
if compare_keyword('if', lexer^.start, lexer^.current.iterator) then
|
||||
token^.kind := lexerKindIf
|
||||
end;
|
||||
if compare_keyword('THEN', lexer^.start, lexer^.current.iterator) then
|
||||
if compare_keyword('then', lexer^.start, lexer^.current.iterator) then
|
||||
token^.kind := lexerKindThen
|
||||
end;
|
||||
if compare_keyword('ELSIF', lexer^.start, lexer^.current.iterator) then
|
||||
if compare_keyword('elsif', lexer^.start, lexer^.current.iterator) then
|
||||
token^.kind := lexerKindElsif
|
||||
end;
|
||||
if compare_keyword('ELSE', lexer^.start, lexer^.current.iterator) then
|
||||
if compare_keyword('else', lexer^.start, lexer^.current.iterator) then
|
||||
token^.kind := lexerKindElse
|
||||
end;
|
||||
if compare_keyword('WHILE', lexer^.start, lexer^.current.iterator) then
|
||||
if compare_keyword('while', lexer^.start, lexer^.current.iterator) then
|
||||
token^.kind := lexerKindWhile
|
||||
end;
|
||||
if compare_keyword('DO', lexer^.start, lexer^.current.iterator) then
|
||||
if compare_keyword('do', lexer^.start, lexer^.current.iterator) then
|
||||
token^.kind := lexerKindDo
|
||||
end;
|
||||
if compare_keyword('proc', lexer^.start, lexer^.current.iterator) then
|
||||
token^.kind := lexerKindProc
|
||||
end;
|
||||
if compare_keyword('BEGIN', lexer^.start, lexer^.current.iterator) then
|
||||
if compare_keyword('begin', lexer^.start, lexer^.current.iterator) then
|
||||
token^.kind := lexerKindBegin
|
||||
end;
|
||||
if compare_keyword('END', lexer^.start, lexer^.current.iterator) then
|
||||
if compare_keyword('end', lexer^.start, lexer^.current.iterator) then
|
||||
token^.kind := lexerKindEnd
|
||||
end;
|
||||
if compare_keyword('TYPE', lexer^.start, lexer^.current.iterator) then
|
||||
if compare_keyword('type', lexer^.start, lexer^.current.iterator) then
|
||||
token^.kind := lexerKindType
|
||||
end;
|
||||
if compare_keyword('RECORD', lexer^.start, lexer^.current.iterator) then
|
||||
if compare_keyword('record', lexer^.start, lexer^.current.iterator) then
|
||||
token^.kind := lexerKindRecord
|
||||
end;
|
||||
if compare_keyword('UNION', lexer^.start, lexer^.current.iterator) then
|
||||
if compare_keyword('union', lexer^.start, lexer^.current.iterator) then
|
||||
token^.kind := lexerKindUnion
|
||||
end;
|
||||
if compare_keyword('NIL', lexer^.start, lexer^.current.iterator) then
|
||||
token^.kind := lexerKindNull
|
||||
end;
|
||||
if compare_keyword('AND', lexer^.start, lexer^.current.iterator) then
|
||||
token^.kind := lexerKindAnd
|
||||
end;
|
||||
if compare_keyword('OR', lexer^.start, lexer^.current.iterator) then
|
||||
if compare_keyword('or', lexer^.start, lexer^.current.iterator) then
|
||||
token^.kind := lexerKindOr
|
||||
end;
|
||||
if compare_keyword('RETURN', lexer^.start, lexer^.current.iterator) then
|
||||
if compare_keyword('return', lexer^.start, lexer^.current.iterator) then
|
||||
token^.kind := lexerKindReturn
|
||||
end;
|
||||
if compare_keyword('DEFINITION', lexer^.start, lexer^.current.iterator) then
|
||||
token^.kind := lexerKindDefinition
|
||||
if compare_keyword('defer', lexer^.start, lexer^.current.iterator) then
|
||||
token^.kind := lexerKindDefer
|
||||
end;
|
||||
if compare_keyword('TO', lexer^.start, lexer^.current.iterator) then
|
||||
token^.kind := lexerKindTo
|
||||
@ -430,11 +427,11 @@ begin
|
||||
if compare_keyword('FROM', lexer^.start, lexer^.current.iterator) then
|
||||
token^.kind := lexerKindFrom
|
||||
end;
|
||||
if compare_keyword('MODULE', lexer^.start, lexer^.current.iterator) then
|
||||
if compare_keyword('module', lexer^.start, lexer^.current.iterator) then
|
||||
token^.kind := lexerKindModule
|
||||
end;
|
||||
if compare_keyword('IMPLEMENTATION', lexer^.start, lexer^.current.iterator) then
|
||||
token^.kind := lexerKindImplementation
|
||||
if compare_keyword('xor', lexer^.start, lexer^.current.iterator) then
|
||||
token^.kind := lexerKindXor
|
||||
end;
|
||||
if compare_keyword('POINTER', lexer^.start, lexer^.current.iterator) then
|
||||
token^.kind := lexerKindPointer
|
||||
|
Reference in New Issue
Block a user