diff --git a/components/jcf2/Parse/BuildParseTree.pas b/components/jcf2/Parse/BuildParseTree.pas index 838a570848..ba0754a662 100644 --- a/components/jcf2/Parse/BuildParseTree.pas +++ b/components/jcf2/Parse/BuildParseTree.pas @@ -2385,7 +2385,20 @@ procedure TBuildParseTree.RecogniseVarDecl; var lc: TSourceToken; begin - // VarDecl -> IdentList ':' Type [(ABSOLUTE (Ident | ConstExpr)) | '=' ConstExpr] + // (* attempted EBNF definition of a variable definition *) + // named : 'name' var_name + // exppubl : ( 'export' | 'public' ) [named] ';' + // external : ( 'external' [[lib_name] [named]] ';' + // absolute : 'absolute' var_name + // initvalue : '=' ConstExpr + // hints : [ 'deprecated' + // | 'experimental' + // | 'platform' + // | 'unimplemented' ] + // identlist : var_name { ',' var_name } + // + // vardef : identlist ':' vartype [ absolute ] ';' + // [( exppubl | external )] [ hints ] PushNode(nVarDecl); @@ -2397,7 +2410,7 @@ begin if lc.TokenType = ttAbsolute then begin - PushNode(nAbsoluteVar); + PushNode(nVarAbsolute); Recognise(ttAbsolute); if (fcTokenList.FirstSolidWordType in IdentifierTypes) then diff --git a/components/jcf2/Parse/BuildTokenList.pas b/components/jcf2/Parse/BuildTokenList.pas index e158cb7284..44dab98901 100644 --- a/components/jcf2/Parse/BuildTokenList.pas +++ b/components/jcf2/Parse/BuildTokenList.pas @@ -113,7 +113,7 @@ uses JcfRegistrySettings; const - CurlyLeft = '{'; //widechar(123); + CurlyLeft = '{'; //widechar(123); CurlyRight = '}'; //widechar(125); function CheckMultiByte(const pcChar: char): boolean; @@ -642,7 +642,7 @@ begin Result := True; end; -{ ~bk 2014.11.01 - Bin numbers are prefixed with % } +{ Bin numbers are prefixed with % } function TBuildTokenList.TryBinNumber(const pcToken: TSourceToken): boolean; begin Result := False; diff --git a/components/jcf2/Parse/ParseTreeNodeType.pas b/components/jcf2/Parse/ParseTreeNodeType.pas index d3292a99d4..bf4016bc11 100644 --- a/components/jcf2/Parse/ParseTreeNodeType.pas +++ b/components/jcf2/Parse/ParseTreeNodeType.pas @@ -77,7 +77,7 @@ type nProcedureType, nVarSection, nVarDecl, - nAbsoluteVar, + nVarAbsolute, nVariableInit, nDesignator, nExpression, @@ -279,7 +279,7 @@ begin Result := 'Var section'; nVarDecl: Result := 'Var decl'; - nAbsoluteVar: + nVarAbsolute: Result := 'Absolute var'; nVariableInit: Result := 'Variable init'; diff --git a/components/jcf2/Parse/Tokens.pas b/components/jcf2/Parse/Tokens.pas index 59134f79cc..11d95141ab 100644 --- a/components/jcf2/Parse/Tokens.pas +++ b/components/jcf2/Parse/Tokens.pas @@ -63,9 +63,9 @@ type ttUnknown, // default category used for unrecognised input // spacing - ttReturn, // CR & LF chars + ttReturn, // CR & LF chars ttWhiteSpace, // spaces & tabs - ttComment, // one of these + ttComment, // one of these ttConditionalCompilationRemoved, @@ -73,13 +73,13 @@ type ttQuotedLiteralString, // 'This is a string' ttSemicolon, // ; ttColon, // : - ttComma, - ttOpenBracket, - ttCloseBracket, - ttOpenSquareBracket, - ttCloseSquareBracket, - ttDot, - ttHash, + ttComma, // , + ttOpenBracket, // ( + ttCloseBracket, // ) + ttOpenSquareBracket, // [ + ttCloseSquareBracket,// ] + ttDot, // . + ttHash, // # ttDoubleDot, // '..' as in '[1 .. 2]' ttAssign, // := ttAmpersand, // '&' is used in Asm diff --git a/components/jcf2/Process/Spacing/SingleSpaceAfter.pas b/components/jcf2/Process/Spacing/SingleSpaceAfter.pas index 89bfdae0bf..2793470e65 100644 --- a/components/jcf2/Process/Spacing/SingleSpaceAfter.pas +++ b/components/jcf2/Process/Spacing/SingleSpaceAfter.pas @@ -152,7 +152,7 @@ begin end; { 'absolute' as a var directive } - if (pt.TokenType = ttAbsolute) and pt.HasParentNode(nAbsoluteVar) then + if (pt.TokenType = ttAbsolute) and pt.HasParentNode(nVarAbsolute) then begin Result := True; exit; diff --git a/components/jcf2/Process/Spacing/SingleSpaceBefore.pas b/components/jcf2/Process/Spacing/SingleSpaceBefore.pas index 4a3118447f..a74ab3f2c7 100644 --- a/components/jcf2/Process/Spacing/SingleSpaceBefore.pas +++ b/components/jcf2/Process/Spacing/SingleSpaceBefore.pas @@ -206,7 +206,7 @@ begin end; { 'absolute' as a var directive } - if (pt.TokenType = ttAbsolute) and pt.HasParentNode(nAbsoluteVar) then + if (pt.TokenType = ttAbsolute) and pt.HasParentNode(nVarAbsolute) then begin Result := True; exit;