JCF2: Support constref keyword. Issue #27677, patch from Julian Puhl.

git-svn-id: trunk@48401 -
This commit is contained in:
juha 2015-03-16 23:40:53 +00:00
parent 308ceaa44c
commit d75669f8f9
2 changed files with 7 additions and 5 deletions

View File

@ -3842,14 +3842,14 @@ end;
procedure TBuildParseTree.RecogniseFormalParam; procedure TBuildParseTree.RecogniseFormalParam;
const const
PARAM_PREFIXES: TTokenTypeSet = [ttVar, ttConst]; PARAM_PREFIXES: TTokenTypeSet = [ttVar, ttConst, ttConstRef];
begin begin
PushNode(nFormalParam); PushNode(nFormalParam);
if (fcTokenList.FirstSolidTokenType = ttOpenSquareBracket) then if (fcTokenList.FirstSolidTokenType = ttOpenSquareBracket) then
RecogniseAttributes; RecogniseAttributes;
{ FormalParm -> [VAR | CONST | OUT] Parameter { FormalParm -> [VAR | CONST | CONSTREF | OUT] Parameter
'out' is different as it is also a param name so this is legal 'out' is different as it is also a param name so this is legal
procedure Foo(out out: integer); procedure Foo(out out: integer);
@ -4479,8 +4479,8 @@ begin
Recognise(ttOpenSquareBracket); Recognise(ttOpenSquareBracket);
repeat repeat
if (fcTokenList.FirstSolidTokenType in [ttConst, ttVar, ttOut]) then if (fcTokenList.FirstSolidTokenType in [ttConst, ttConstref, ttVar, ttOut]) then
Recognise([ttConst, ttVar, ttOut]); Recognise([ttConst, ttConstref, ttVar, ttOut]);
RecogniseIdentList(False); RecogniseIdentList(False);
Recognise(ttColon); Recognise(ttColon);

View File

@ -93,6 +93,7 @@ type
ttCase, ttCase,
ttClass, ttClass,
ttConst, ttConst,
ttConstref,
ttContains, ttContains,
ttConstructor, ttConstructor,
ttDestructor, ttDestructor,
@ -322,7 +323,7 @@ const
Declarations: TTokenTypeSet = Declarations: TTokenTypeSet =
[ttConst, ttResourceString, ttVar, ttThreadVar, ttType, ttLabel, ttExports]; [ttConst, ttResourceString, ttVar, ttThreadVar, ttType, ttLabel, ttExports];
ParamTypes: TTokenTypeSet = [ttVar, ttConst, ttOut]; ParamTypes: TTokenTypeSet = [ttVar, ttConst, ttConstref, ttOut];
BlockOutdentWords: TTokenTypeSet = BlockOutdentWords: TTokenTypeSet =
[ttVar, ttThreadVar, ttConst, ttResourceString, ttType, ttLabel, [ttVar, ttThreadVar, ttConst, ttResourceString, ttType, ttLabel,
@ -581,6 +582,7 @@ begin
AddKeyword('case', wtReservedWord, ttCase); AddKeyword('case', wtReservedWord, ttCase);
AddKeyword('class', wtReservedWord, ttClass); AddKeyword('class', wtReservedWord, ttClass);
AddKeyword('const', wtReservedWord, ttConst); AddKeyword('const', wtReservedWord, ttConst);
AddKeyword('constref', wtReservedWordDirective, ttConstref);
AddKeyword('constructor', wtReservedWord, ttConstructor); AddKeyword('constructor', wtReservedWord, ttConstructor);
AddKeyword('destructor', wtReservedWord, ttDestructor); AddKeyword('destructor', wtReservedWord, ttDestructor);