mirror of https://gitlab.com/basile.b/dexed.git
fix, lexer needed full bool eval
This commit is contained in:
parent
10796ab262
commit
1655300dfe
|
|
@ -385,7 +385,7 @@ begin
|
||||||
Result.fIndex := -1;
|
Result.fIndex := -1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$BOOLEVAL ON}
|
|
||||||
procedure lex(const aText: string; aList: TLexTokenList; aCallBack: TLexFoundEvent = nil);
|
procedure lex(const aText: string; aList: TLexTokenList; aCallBack: TLexFoundEvent = nil);
|
||||||
var
|
var
|
||||||
reader: TReaderHead;
|
reader: TReaderHead;
|
||||||
|
|
@ -473,9 +473,11 @@ begin
|
||||||
reader.saveBeginning;
|
reader.saveBeginning;
|
||||||
if isOutOfBound then
|
if isOutOfBound then
|
||||||
exit;
|
exit;
|
||||||
while (reader.head^ <> '*') or (reader.Next^ <> '/') do
|
reader.Next;
|
||||||
|
while (reader.head^ <> '/') or ((reader.head - 1)^ <> '*') do
|
||||||
begin
|
begin
|
||||||
identifier += reader.head^;
|
identifier += reader.head^;
|
||||||
|
reader.Next;
|
||||||
if isOutOfBound then
|
if isOutOfBound then
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
@ -499,7 +501,7 @@ begin
|
||||||
if isOutOfBound then
|
if isOutOfBound then
|
||||||
exit;
|
exit;
|
||||||
repeat
|
repeat
|
||||||
while ((reader.head^ <> '+') or (reader.head^ <> '/')) or
|
while ((reader.head^ <> '+') or (reader.head^ <> '/')) and
|
||||||
((reader.next^ <> '/') or (reader.head^ <> '+')) do
|
((reader.next^ <> '/') or (reader.head^ <> '+')) do
|
||||||
begin
|
begin
|
||||||
if isOutOfBound then
|
if isOutOfBound then
|
||||||
|
|
@ -620,7 +622,9 @@ begin
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// token string
|
// token string
|
||||||
if (reader.head^ = 'q') and (reader.Next^ = '{') then
|
if (reader.head^ = 'q') then
|
||||||
|
begin
|
||||||
|
if (reader.Next^ = '{') then
|
||||||
begin
|
begin
|
||||||
reader.saveBeginning;
|
reader.saveBeginning;
|
||||||
reader.Next;
|
reader.Next;
|
||||||
|
|
@ -631,11 +635,11 @@ begin
|
||||||
if callBackDoStop then
|
if callBackDoStop then
|
||||||
exit;
|
exit;
|
||||||
continue;
|
continue;
|
||||||
end
|
end else
|
||||||
else
|
|
||||||
reader.previous;
|
reader.previous;
|
||||||
|
end;
|
||||||
|
|
||||||
//chars, note: same escape error as in SynD2Syn
|
//chars
|
||||||
if (reader.head^ = #39) then
|
if (reader.head^ = #39) then
|
||||||
begin
|
begin
|
||||||
reader.Next;
|
reader.Next;
|
||||||
|
|
@ -783,7 +787,7 @@ begin
|
||||||
continue;
|
continue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// symbChars
|
// symbols
|
||||||
if isSymbol(reader.head^) then
|
if isSymbol(reader.head^) then
|
||||||
begin
|
begin
|
||||||
reader.saveBeginning;
|
reader.saveBeginning;
|
||||||
|
|
@ -922,6 +926,12 @@ begin
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// error
|
// error
|
||||||
|
while not isWhite(reader.head^) do
|
||||||
|
begin
|
||||||
|
if isOutOfBound then
|
||||||
|
break;
|
||||||
|
reader.Next;
|
||||||
|
end;
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF DEBUG}
|
||||||
identifier += ' (unrecognized lexer input)';
|
identifier += ' (unrecognized lexer input)';
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
@ -929,8 +939,6 @@ begin
|
||||||
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$BOOLEVAL OFF}
|
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
|
||||||
{$REGION Syntactic errors}
|
{$REGION Syntactic errors}
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,6 @@ function tryReadDelim(var aReader: PChar; var aPosition: Integer; const aDelim:
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{$BOOLEVAL ON}
|
|
||||||
function isWhite(const c: Char): boolean; {$IFNDEF DEBUG}inline;{$ENDIF}
|
function isWhite(const c: Char): boolean; {$IFNDEF DEBUG}inline;{$ENDIF}
|
||||||
begin
|
begin
|
||||||
exit(c in [#0..#32]);
|
exit(c in [#0..#32]);
|
||||||
|
|
@ -158,7 +157,6 @@ function isFirstIdentifier(const c: char): boolean; {$IFNDEF DEBUG}inline;{$ENDI
|
||||||
begin
|
begin
|
||||||
exit(isIdentifier(c) and (not isNumber(c)));
|
exit(isIdentifier(c) and (not isNumber(c)));
|
||||||
end;
|
end;
|
||||||
{$BOOLEVAL OFF}
|
|
||||||
|
|
||||||
function readLine(var aReader: PChar; var aPosition: Integer): boolean;
|
function readLine(var aReader: PChar; var aPosition: Integer): boolean;
|
||||||
begin
|
begin
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue