From a739015b9c7f4cc624fee9ade477265f07ed8694 Mon Sep 17 00:00:00 2001 From: juha Date: Sun, 23 Nov 2014 16:24:58 +0000 Subject: [PATCH] JCF: Support for "enumerator" operator. Patch from Julian Puhl. git-svn-id: trunk@46973 - --- components/jcf2/Parse/BuildParseTree.pas | 14 ++++++++++++-- components/jcf2/Parse/Tokens.pas | 6 ++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/components/jcf2/Parse/BuildParseTree.pas b/components/jcf2/Parse/BuildParseTree.pas index feee2c7b43..784f72e151 100644 --- a/components/jcf2/Parse/BuildParseTree.pas +++ b/components/jcf2/Parse/BuildParseTree.pas @@ -2330,7 +2330,7 @@ const OperatorTokens: TTokenTypeSet = [ttPlus, ttMinus, ttTimes, ttFloatDiv, ttExponent, ttEquals, ttGreaterThan, ttLessThan, ttGreaterThanOrEqual, ttLessThanOrEqual, ttAssign, ttPlusAssign, ttMinusAssign, ttTimesAssign, ttFloatDivAssign, ttXor, - ttAnd, ttOr]; + ttAnd, ttOr, ttEnumerator]; begin Recognise(OperatorTokens); end; @@ -3960,6 +3960,11 @@ begin Recognise(ttMessage); RecogniseConstantExpression; end; + ttEnumerator: + begin + Recognise(ttEnumerator); + RecogniseIdentifier(False, idStrict); + end else Recognise(ProcedureDirectives); end; @@ -5325,7 +5330,7 @@ const for non-array properties it is followed by an identifier } - PropertyDirectives = [ttDefault, ttNoDefault, ttStored]; + PropertyDirectives = [ttDefault, ttNoDefault, ttStored, ttEnumerator]; begin if ((fcTokenList.FirstSolidTokenType = ttSemicolon) and (fcTokenList.SolidTokenType(2) in PropertyDirectives)) or @@ -5355,6 +5360,11 @@ begin if fcTokenList.FirstSolidTokenType <> ttSemicolon then RecogniseConstantExpression; end; + ttEnumerator: + begin + Recognise(ttEnumerator); + RecogniseIdentifier(False, idStrict); + end; end; PopNode; diff --git a/components/jcf2/Parse/Tokens.pas b/components/jcf2/Parse/Tokens.pas index f11843eb65..c6546e088e 100644 --- a/components/jcf2/Parse/Tokens.pas +++ b/components/jcf2/Parse/Tokens.pas @@ -101,6 +101,7 @@ type ttDownto, ttElse, ttEnd, + ttEnumerator, ttExcept, ttExports, ttFile, @@ -350,7 +351,7 @@ const ttVirtual, ttCdecl, ttMessage, ttName, ttRegister, ttDispId, ttNear, ttDynamic, ttExport, ttOverride, ttResident, ttLocal, ttOverload, ttReintroduce, - ttDeprecated, ttLibrary, ttPlatform, ttStatic, ttFinal, ttVarArgs, ttUnsafe]; + ttDeprecated, ttLibrary, ttPlatform, ttStatic, ttFinal, ttVarArgs, ttUnsafe, ttEnumerator]; ClassDirectives: TTokenTypeSet = [ttPrivate, ttProtected, ttPublic, ttPublished, ttAutomated, ttStrict]; @@ -382,7 +383,7 @@ const VariantTypes: TTokenTypeSet = [ttVariant, ttOleVariant]; - Operators: TTokenTypeSet = [ttAnd .. ttNotEqual]; + Operators: TTokenTypeSet = [ttAnd .. ttNotEqual, ttEnumerator]; { these words are - operators @@ -578,6 +579,7 @@ begin AddKeyword('downto', wtReservedWord, ttDownTo); AddKeyword('else', wtReservedWord, ttElse); AddKeyword('end', wtReservedWord, ttEnd); + AddKeyword('enumerator', wtReservedWord, ttEnumerator); AddKeyword('except', wtReservedWord, ttExcept); AddKeyword('exports', wtReservedWord, ttExports); AddKeyword('file', wtReservedWord, ttFile);