Skip to content

Commit e6d6315

Browse files
committed
Tidy usages of constExpression in the grammar
Some of our `constExpression` usages were in places that couldn't actually have an array or record literal.
1 parent 3a86eea commit e6d6315

File tree

1 file changed

+4
-4
lines changed
  • delphi-frontend/src/main/antlr3/au/com/integradev/delphi/antlr

1 file changed

+4
-4
lines changed

delphi-frontend/src/main/antlr3/au/com/integradev/delphi/antlr/Delphi.g

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ varSection : (VAR<VarSectionNodeImpl>^ | THREADVAR<VarSectionN
482482
varDeclaration : attributeList? nameDeclarationList ':' varType portabilityDirective* varValueSpec? portabilityDirective* ';'
483483
-> ^(TkVarDeclaration<VarDeclarationNodeImpl> nameDeclarationList varType varValueSpec? attributeList?)
484484
;
485-
varValueSpec : ABSOLUTE constExpression
485+
varValueSpec : ABSOLUTE expression
486486
| '=' constExpression
487487
;
488488
exportsSection : EXPORTS ident exportItem (',' ident exportItem)* ';'
@@ -643,7 +643,7 @@ interfaceItem : routineInterface
643643
;
644644
objectType : OBJECT<ObjectTypeNodeImpl>^ classParent? visibilitySection* END // Obselete, kept for backwards compatibility with Turbo Pascal
645645
; // See: https://www.oreilly.com/library/view/delphi-in-a/1565926595/re192.html
646-
recordType : RECORD<RecordTypeNodeImpl>^ visibilitySection* recordVariantSection? END (ALIGN constExpression)?
646+
recordType : RECORD<RecordTypeNodeImpl>^ visibilitySection* recordVariantSection? END (ALIGN expression)?
647647
;
648648
recordVariantSection : CASE<RecordVariantSectionNodeImpl>^ recordVariantTag OF recordVariant+
649649
;
@@ -1105,8 +1105,8 @@ externalDirective : EXTERNAL^ dllName? externalSpecifier*
11051105
;
11061106
dllName : {!input.LT(1).getText().equals("name")}? expression
11071107
;
1108-
externalSpecifier : NAME^ constExpression
1109-
| INDEX^ constExpression // specific to a platform
1108+
externalSpecifier : NAME^ expression
1109+
| INDEX^ expression // specific to a platform
11101110
| DELAYED // Use delayed loading (See: http://docwiki.embarcadero.com/RADStudio/en/Libraries_and_Packages_(Delphi))
11111111
;
11121112
dispIDDirective : DISPID expression

0 commit comments

Comments
 (0)