mirror of https://gitlab.com/basile.b/dexed.git
bit less tolerant HL lexer
This commit is contained in:
parent
a9b8f0554d
commit
930d3577e5
|
@ -815,11 +815,15 @@ begin
|
||||||
exit;
|
exit;
|
||||||
end else readerReset;
|
end else readerReset;
|
||||||
|
|
||||||
// numbers 1
|
// numbers
|
||||||
if (isNumber(reader^)) then
|
if (isNumber(reader^)) then
|
||||||
begin
|
begin
|
||||||
while isAlNum(readerNext^) or (reader^ = '_') or (reader^ = '.') do (*!*);
|
while isHex(readerNext^) or (reader^ = '_') or (reader^ = '.')
|
||||||
fTokKind := tkNumbr;
|
or (reader^ in ['x', 'X', 'u', 'U', 'L', 'i']) do (*!*);
|
||||||
|
if isWhite(reader^) or isSymbol(reader^) or isOperator1(reader^) then
|
||||||
|
fTokKind := tkNumbr
|
||||||
|
else
|
||||||
|
fTokKind := tkError;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -828,6 +832,8 @@ begin
|
||||||
begin
|
begin
|
||||||
fTokKind := tkSymbl;
|
fTokKind := tkSymbl;
|
||||||
case reader^ of
|
case reader^ of
|
||||||
|
';': if (fTokStop>1) and ((reader-1)^ = '}') then
|
||||||
|
fTokKind := tkError;
|
||||||
'{': StartCodeFoldBlock(nil, fkBrackets in fFoldKinds);
|
'{': StartCodeFoldBlock(nil, fkBrackets in fFoldKinds);
|
||||||
'}':
|
'}':
|
||||||
begin
|
begin
|
||||||
|
@ -846,7 +852,7 @@ begin
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// symbChars 2: operators
|
// operators
|
||||||
if isOperator1(reader^) then
|
if isOperator1(reader^) then
|
||||||
begin
|
begin
|
||||||
fTokKind := tkSymbl;
|
fTokKind := tkSymbl;
|
||||||
|
@ -859,7 +865,9 @@ begin
|
||||||
end;
|
end;
|
||||||
3:begin
|
3:begin
|
||||||
if (not isOperator1(reader^)) and
|
if (not isOperator1(reader^)) and
|
||||||
isOperator3(fLineBuf[fTokStart..fTokStop-1])
|
(isOperator3(fLineBuf[fTokStart..fTokStop-1]) or
|
||||||
|
(isOperator2(fLineBuf[fTokStart..fTokStop-2]) and
|
||||||
|
isPostOpSymbol(fLineBuf[fTokStop-1])))
|
||||||
then exit;
|
then exit;
|
||||||
end;
|
end;
|
||||||
2:begin
|
2:begin
|
||||||
|
@ -871,9 +879,9 @@ begin
|
||||||
if not isOperator1(reader^) then exit;
|
if not isOperator1(reader^) then exit;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
if isWhite(reader^) then
|
fTokKind := tkError;
|
||||||
|
//if isWhite(reader^) then
|
||||||
exit;
|
exit;
|
||||||
fTokKind := tkIdent; // invalid op not colorized.
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//Keyword - identifiers
|
//Keyword - identifiers
|
||||||
|
|
|
@ -27,6 +27,7 @@ function isAlNum(const c: Char): boolean; {$IFNDEF DEBUG}inline;{$ENDIF}
|
||||||
function isHex(const c: Char): boolean; {$IFNDEF DEBUG}inline;{$ENDIF}
|
function isHex(const c: Char): boolean; {$IFNDEF DEBUG}inline;{$ENDIF}
|
||||||
function isSymbol(const c: char): boolean; {$IFNDEF DEBUG}inline;{$ENDIF}
|
function isSymbol(const c: char): boolean; {$IFNDEF DEBUG}inline;{$ENDIF}
|
||||||
function isPtrOperator(const c: char): boolean; {$IFNDEF DEBUG}inline;{$ENDIF}
|
function isPtrOperator(const c: char): boolean; {$IFNDEF DEBUG}inline;{$ENDIF}
|
||||||
|
function isPostOpSymbol(const c: char): boolean; {$IFNDEF DEBUG} inline; {$ENDIF}
|
||||||
function isOperator1(const c: char): boolean; {$IFNDEF DEBUG}inline;{$ENDIF}
|
function isOperator1(const c: char): boolean; {$IFNDEF DEBUG}inline;{$ENDIF}
|
||||||
function isOperator2(const s: string): boolean; {$IFNDEF DEBUG}inline;{$ENDIF}
|
function isOperator2(const s: string): boolean; {$IFNDEF DEBUG}inline;{$ENDIF}
|
||||||
function isOperator3(const s: string): boolean; {$IFNDEF DEBUG} inline; {$ENDIF}
|
function isOperator3(const s: string): boolean; {$IFNDEF DEBUG} inline; {$ENDIF}
|
||||||
|
@ -101,6 +102,11 @@ begin
|
||||||
exit(c in ['&', '*']);
|
exit(c in ['&', '*']);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function isPostOpSymbol (const c: char): boolean; {$IFNDEF DEBUG}inline;{$ENDIF}
|
||||||
|
begin
|
||||||
|
exit(c in ['+', '-', '*', '&']);
|
||||||
|
end;
|
||||||
|
|
||||||
function isOperator1(const c: char): boolean; {$IFNDEF DEBUG}inline;{$ENDIF}
|
function isOperator1(const c: char): boolean; {$IFNDEF DEBUG}inline;{$ENDIF}
|
||||||
begin
|
begin
|
||||||
exit(c in ['/', '*', '-', '+', '%', '>', '<', '=', '!', '&', '|', '^', '~']);
|
exit(c in ['/', '*', '-', '+', '%', '>', '<', '=', '!', '&', '|', '^', '~']);
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
- new symbolic strings, ENV_XXX, see issue #27
|
Loading…
Reference in New Issue