diff --git a/src/ce_d2syn.pas b/src/ce_d2syn.pas index a5896011..870a70e2 100644 --- a/src/ce_d2syn.pas +++ b/src/ce_d2syn.pas @@ -815,11 +815,15 @@ begin exit; end else readerReset; - // numbers 1 + // numbers if (isNumber(reader^)) then begin - while isAlNum(readerNext^) or (reader^ = '_') or (reader^ = '.') do (*!*); - fTokKind := tkNumbr; + while isHex(readerNext^) or (reader^ = '_') or (reader^ = '.') + 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; end; @@ -828,6 +832,8 @@ begin begin fTokKind := tkSymbl; case reader^ of + ';': if (fTokStop>1) and ((reader-1)^ = '}') then + fTokKind := tkError; '{': StartCodeFoldBlock(nil, fkBrackets in fFoldKinds); '}': begin @@ -846,7 +852,7 @@ begin exit; end; - // symbChars 2: operators + // operators if isOperator1(reader^) then begin fTokKind := tkSymbl; @@ -859,7 +865,9 @@ begin end; 3:begin 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; end; 2:begin @@ -871,9 +879,9 @@ begin if not isOperator1(reader^) then exit; end; end; - if isWhite(reader^) then - exit; - fTokKind := tkIdent; // invalid op not colorized. + fTokKind := tkError; + //if isWhite(reader^) then + exit; end; //Keyword - identifiers diff --git a/src/ce_dlangutils.pas b/src/ce_dlangutils.pas index 4c6fff91..a79fbcb4 100644 --- a/src/ce_dlangutils.pas +++ b/src/ce_dlangutils.pas @@ -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 isSymbol(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 isOperator2(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 ['&', '*']); 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} begin exit(c in ['/', '*', '-', '+', '%', '>', '<', '=', '!', '&', '|', '^', '~']); diff --git a/wiki/wiki.todo.txt b/wiki/wiki.todo.txt index e69de29b..b268e72d 100644 --- a/wiki/wiki.todo.txt +++ b/wiki/wiki.todo.txt @@ -0,0 +1 @@ +- new symbolic strings, ENV_XXX, see issue #27 \ No newline at end of file