JCF: Support for "enumerator" operator. Patch from Julian Puhl.

git-svn-id: trunk@46973 -
This commit is contained in:
juha 2014-11-23 16:24:58 +00:00
parent 5aecba92a0
commit a739015b9c
2 changed files with 16 additions and 4 deletions

View File

@ -2330,7 +2330,7 @@ const
OperatorTokens: TTokenTypeSet = [ttPlus, ttMinus, ttTimes, ttFloatDiv, ttExponent, OperatorTokens: TTokenTypeSet = [ttPlus, ttMinus, ttTimes, ttFloatDiv, ttExponent,
ttEquals, ttGreaterThan, ttLessThan, ttGreaterThanOrEqual, ttLessThanOrEqual, ttEquals, ttGreaterThan, ttLessThan, ttGreaterThanOrEqual, ttLessThanOrEqual,
ttAssign, ttPlusAssign, ttMinusAssign, ttTimesAssign, ttFloatDivAssign, ttXor, ttAssign, ttPlusAssign, ttMinusAssign, ttTimesAssign, ttFloatDivAssign, ttXor,
ttAnd, ttOr]; ttAnd, ttOr, ttEnumerator];
begin begin
Recognise(OperatorTokens); Recognise(OperatorTokens);
end; end;
@ -3960,6 +3960,11 @@ begin
Recognise(ttMessage); Recognise(ttMessage);
RecogniseConstantExpression; RecogniseConstantExpression;
end; end;
ttEnumerator:
begin
Recognise(ttEnumerator);
RecogniseIdentifier(False, idStrict);
end
else else
Recognise(ProcedureDirectives); Recognise(ProcedureDirectives);
end; end;
@ -5325,7 +5330,7 @@ const
for non-array properties it is followed by an identifier for non-array properties it is followed by an identifier
} }
PropertyDirectives = [ttDefault, ttNoDefault, ttStored]; PropertyDirectives = [ttDefault, ttNoDefault, ttStored, ttEnumerator];
begin begin
if ((fcTokenList.FirstSolidTokenType = ttSemicolon) and if ((fcTokenList.FirstSolidTokenType = ttSemicolon) and
(fcTokenList.SolidTokenType(2) in PropertyDirectives)) or (fcTokenList.SolidTokenType(2) in PropertyDirectives)) or
@ -5355,6 +5360,11 @@ begin
if fcTokenList.FirstSolidTokenType <> ttSemicolon then if fcTokenList.FirstSolidTokenType <> ttSemicolon then
RecogniseConstantExpression; RecogniseConstantExpression;
end; end;
ttEnumerator:
begin
Recognise(ttEnumerator);
RecogniseIdentifier(False, idStrict);
end;
end; end;
PopNode; PopNode;

View File

@ -101,6 +101,7 @@ type
ttDownto, ttDownto,
ttElse, ttElse,
ttEnd, ttEnd,
ttEnumerator,
ttExcept, ttExcept,
ttExports, ttExports,
ttFile, ttFile,
@ -350,7 +351,7 @@ const
ttVirtual, ttCdecl, ttMessage, ttName, ttRegister, ttDispId, ttVirtual, ttCdecl, ttMessage, ttName, ttRegister, ttDispId,
ttNear, ttDynamic, ttExport, ttOverride, ttResident, ttLocal, ttNear, ttDynamic, ttExport, ttOverride, ttResident, ttLocal,
ttOverload, ttReintroduce, ttOverload, ttReintroduce,
ttDeprecated, ttLibrary, ttPlatform, ttStatic, ttFinal, ttVarArgs, ttUnsafe]; ttDeprecated, ttLibrary, ttPlatform, ttStatic, ttFinal, ttVarArgs, ttUnsafe, ttEnumerator];
ClassDirectives: TTokenTypeSet = ClassDirectives: TTokenTypeSet =
[ttPrivate, ttProtected, ttPublic, ttPublished, ttAutomated, ttStrict]; [ttPrivate, ttProtected, ttPublic, ttPublished, ttAutomated, ttStrict];
@ -382,7 +383,7 @@ const
VariantTypes: TTokenTypeSet = [ttVariant, ttOleVariant]; VariantTypes: TTokenTypeSet = [ttVariant, ttOleVariant];
Operators: TTokenTypeSet = [ttAnd .. ttNotEqual]; Operators: TTokenTypeSet = [ttAnd .. ttNotEqual, ttEnumerator];
{ these words are { these words are
- operators - operators
@ -578,6 +579,7 @@ begin
AddKeyword('downto', wtReservedWord, ttDownTo); AddKeyword('downto', wtReservedWord, ttDownTo);
AddKeyword('else', wtReservedWord, ttElse); AddKeyword('else', wtReservedWord, ttElse);
AddKeyword('end', wtReservedWord, ttEnd); AddKeyword('end', wtReservedWord, ttEnd);
AddKeyword('enumerator', wtReservedWord, ttEnumerator);
AddKeyword('except', wtReservedWord, ttExcept); AddKeyword('except', wtReservedWord, ttExcept);
AddKeyword('exports', wtReservedWord, ttExports); AddKeyword('exports', wtReservedWord, ttExports);
AddKeyword('file', wtReservedWord, ttFile); AddKeyword('file', wtReservedWord, ttFile);