@@ -89,5 +89,37 @@ public void DataType(string type, string value)
8989 parser . AddErrorListener ( new ThrowingErrorListener ( ) ) ;
9090 new UnrealAngelscriptSimpleVisitor ( script ) . VisitChildren ( parser . script ( ) ) ;
9191 }
92+
93+ [ TestMethod ]
94+ [ DataRow ( "" ) ]
95+ [ DataRow ( "UCLASS()" ) ]
96+ [ DataRow ( "UCLASS(Abstract)" ) ]
97+ public void UClass ( string annotation )
98+ {
99+ var script = $ "{ annotation } class ClassName : BaseClass {{}};";
100+ var lexer = new UnrealAngelscriptLexer ( new AntlrInputStream ( script ) ) ;
101+ var tokenStream = new CommonTokenStream ( lexer ) ;
102+ var parser = new UnrealAngelscriptParser ( tokenStream ) ;
103+ parser . RemoveErrorListeners ( ) ;
104+ parser . AddErrorListener ( new ThrowingErrorListener ( ) ) ;
105+ new UnrealAngelscriptSimpleVisitor ( script ) . VisitChildren ( parser . script ( ) ) ;
106+ }
107+
108+ [ TestMethod ]
109+ [ DataRow ( "" ) ]
110+ [ DataRow ( "UPROPERTY()" ) ]
111+ [ DataRow ( "UPROPERTY(DefaultComponent)" ) ]
112+ [ DataRow ( "UPROPERTY(DefaultComponent,)" ) ]
113+ [ DataRow ( "UPROPERTY(DefaultComponent, RootComponent)" ) ]
114+ public void UProperty ( string annotation )
115+ {
116+ var script = $ "class ClassName : BaseClass\r \n {{\r \n \t { annotation } \r \n DummyType DummyProperty;\r \n }};";
117+ var lexer = new UnrealAngelscriptLexer ( new AntlrInputStream ( script ) ) ;
118+ var tokenStream = new CommonTokenStream ( lexer ) ;
119+ var parser = new UnrealAngelscriptParser ( tokenStream ) ;
120+ parser . RemoveErrorListeners ( ) ;
121+ parser . AddErrorListener ( new ThrowingErrorListener ( ) ) ;
122+ new UnrealAngelscriptSimpleVisitor ( script ) . VisitChildren ( parser . script ( ) ) ;
123+ }
92124 }
93125}
0 commit comments