Skip to content

Commit 33d5f6f

Browse files
committed
Support for external directive
Support <namespace>.<value> for keywords Plugin crashes if deadcode metrics cannot find a unit, now only give a warning
1 parent f783159 commit 33d5f6f

File tree

6 files changed

+12983
-15884
lines changed

6 files changed

+12983
-15884
lines changed

src/main/antlr3/org/sonar/plugins/delphi/antlr/Delphi.g

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ declSection : labelDeclSection
132132
| constSection
133133
| typeSection
134134
| varSection
135-
| exportedProcHeading
136135
| methodDecl
137136
| procDecl
138137
| exportsSection
@@ -240,7 +239,7 @@ subRangeType : constExpression ('..' constExpression)?
240239
;
241240
enumType : '(' ident ('=' expression)? (',' ident ('=' expression)? )* ')'
242241
;
243-
typeId : namespacedQualifiedIdent
242+
typeId : qualifiedIdent
244243
;
245244
//****************************
246245
//section generics
@@ -452,7 +451,7 @@ customAttributeList : (customAttributeDecl)*
452451
;
453452
customAttributeDecl : '[' customAttributeIdent ('(' (expressionList)? ')')? ']' -> ^(TkCustomAttribute '[' customAttributeIdent ('(' (expressionList)? ')')? ']')
454453
;
455-
customAttributeIdent : namespacedQualifiedIdent (':' namespacedQualifiedIdent)?
454+
customAttributeIdent : qualifiedIdent (':' qualifiedIdent)?
456455
;
457456
//****************************
458457
//section expression
@@ -487,7 +486,7 @@ stringFactor : ControlString (QuotedString ControlString)* (Quot
487486
setSection : '[' (expression ((',' | '..') expression)*)? ']'
488487
;
489488
490-
designator : ('inherited')? ( (namespacedQualifiedIdent | typeId) )? (designatorItem)*
489+
designator : ('inherited')? ( (qualifiedIdent | typeId) )? (designatorItem)*
491490
;
492491
designatorItem : '^'
493492
| ('.' | '@') ident //CHANGED added '@'
@@ -618,13 +617,15 @@ methodDirective : reintroduceDirective // 1
618617
| hintingDirective ';' // 4 (niet abstract)
619618
| oldCallConventionDirective // 1
620619
| dispIDDirective
620+
| externalDirective
621621
;
622622
functionDirective : overloadDirective // 1
623623
| inlineDirective // 1
624624
| callConvention // 1
625625
| oldCallConventionDirective // 1
626626
| hintingDirective ';' // 1
627627
| (callConventionNoSemi)? externalDirective // 1
628+
| externalDirective
628629
| 'unsafe' ';' // 1 .net?
629630
;
630631
reintroduceDirective : 'reintroduce' ';'
@@ -686,7 +687,7 @@ ident : TkIdentifier
686687
usedKeywordsAsNames : (NAME | READONLY | ADD | AT | MESSAGE | POINTER | INDEX | DEFAULT | STRING | CONTINUE)
687688
| (READ | WRITE | REGISTER | VARIANT | OPERATOR | REMOVE | LOCAL | REFERENCE | CONTAINS | FINAL)
688689
| (BREAK | EXIT | STRICT | OUT | OBJECT | EXPORT | ANSISTRING | IMPLEMENTS | STORED )
689-
| (UNSAFE | STATIC)
690+
| (UNSAFE | STATIC | DQ | DW | VARARGS | VARIANT | VIRTUAL | WRITE | WRITEONLY | FALSE | TRUE)
690691
;
691692
keywordsAsIdentifier : (ABSOLUTE | ABSTRACT | ADD | AND | ANSISTRING | ARRAY | AS | ASM | ASSEMBLER | ASSEMBLY)
692693
| (AT | AUTOMATED | BEGIN | BREAK | CASE | CDECL | CLASS | CONST | CONSTRUCTOR | CONTAINS)
@@ -717,8 +718,6 @@ intRealNum : TkRealNum
717718
intNum : TkIntNum
718719
| TkHexNum
719720
;
720-
namespacedQualifiedIdent : (namespaceName '.')? qualifiedIdent
721-
;
722721
namespaceName : ident ('.' ident)*
723722
;
724723
qualifiedIdent : (ident '.')* ident //must stay the way it is, with '.' for proper class method identyfication

0 commit comments

Comments
 (0)