Skip to content

Commit 4db3b66

Browse files
committed
Implement static class functions, Implements #19
1 parent e1ec47d commit 4db3b66

19 files changed

+1040
-834
lines changed

pom.xml

Lines changed: 42 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,16 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0"
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
5+
http://maven.apache.org/xsd/maven-4.0.0.xsd">
56
<modelVersion>4.0.0</modelVersion>
67

78
<groupId>org.luapp</groupId>
89
<artifactId>lpp</artifactId>
910
<version>1.0-SNAPSHOT</version>
10-
<build>
11-
<plugins>
12-
<plugin>
13-
<groupId>org.apache.maven.plugins</groupId>
14-
<artifactId>maven-compiler-plugin</artifactId>
15-
<configuration>
16-
<source>8</source>
17-
<target>8</target>
18-
</configuration>
19-
</plugin>
20-
</plugins>
21-
</build>
11+
<packaging>jar</packaging>
2212

2313
<repositories>
24-
<!-- <repository>-->
25-
<!-- <id> central</id>-->
26-
<!-- <url> http://repo.maven.apache.org/maven2/</url>-->
27-
<!-- </repository>-->
2814

2915
</repositories>
3016

@@ -33,17 +19,13 @@
3319
<!-- https://mvnrepository.com/artifact/org.antlr/antlr4-runtime -->
3420
<dependency>
3521
<groupId>org.antlr</groupId>
36-
<artifactId>antlr4-runtime</artifactId>
37-
<scope>system</scope>
38-
<version>4.8-1</version>
39-
<systemPath> ${project.basedir}/libs/antlr4-runtime-4.8-1.jar</systemPath>
22+
<artifactId>antlr-runtime</artifactId>
23+
<version>3.5.2</version>
4024
</dependency>
4125
<dependency>
4226
<groupId>org.antlr</groupId>
4327
<artifactId>antlr</artifactId>
4428
<version>3.5.2</version>
45-
<scope>system</scope>
46-
<systemPath> ${project.basedir}/libs/antlr4-4.8-1.jar</systemPath>
4729
</dependency>
4830
<dependency>
4931
<groupId>org.reflections</groupId>
@@ -52,6 +34,43 @@
5234
</dependency>
5335

5436
</dependencies>
37+
<build>
38+
39+
<finalName>luapp</finalName>
40+
<plugins>
41+
42+
<plugin>
43+
<groupId>org.apache.maven.plugins</groupId>
44+
<artifactId>maven-compiler-plugin</artifactId>
45+
<version>3.1</version>
46+
<configuration>
47+
<source>1.8</source>
48+
<target>1.8</target>
49+
</configuration>
50+
</plugin>
5551

52+
<plugin>
53+
<groupId>org.apache.maven.plugins</groupId>
54+
<artifactId>maven-assembly-plugin</artifactId>
55+
<version>3.1.1</version>
5656

57+
<configuration>
58+
<descriptorRefs>
59+
<descriptorRef>jar-with-dependencies</descriptorRef>
60+
</descriptorRefs>
61+
</configuration>
62+
63+
<executions>
64+
<execution>
65+
<id>make-assembly</id>
66+
<phase>package</phase>
67+
<goals>
68+
<goal>single</goal>
69+
</goals>
70+
</execution>
71+
</executions>
72+
73+
</plugin>
74+
</plugins>
75+
</build>
5776
</project>

src/main/java/org/luapp/language/Main.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class Main {
1111
public static String output = "";
1212

1313
public static void main(String[] args){
14-
String path = args[0];
14+
String path = "C:\\Users\\Harry\\Desktop\\Lua\\lua-plus-plus\\src\\main\\java\\org\\luapp\\language\\test.lpp";//args[0];
1515
Main.luaPPInstance = new Luapp(path);
1616
Main.luaPPInstance.load();
1717
}

src/main/java/org/luapp/language/generator/luapp.interp

Lines changed: 4 additions & 1 deletion
Large diffs are not rendered by default.

src/main/java/org/luapp/language/generator/luapp.tokens

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,19 @@ T__63=64
6565
T__64=65
6666
T__65=66
6767
T__66=67
68-
NAME=68
69-
NORMALSTRING=69
70-
CHARSTRING=70
71-
LONGSTRING=71
72-
INT=72
73-
HEX=73
74-
FLOAT=74
75-
HEX_FLOAT=75
76-
COMMENT=76
77-
LINE_COMMENT=77
78-
WS=78
79-
SHEBANG=79
68+
T__67=68
69+
NAME=69
70+
NORMALSTRING=70
71+
CHARSTRING=71
72+
LONGSTRING=72
73+
INT=73
74+
HEX=74
75+
FLOAT=75
76+
HEX_FLOAT=76
77+
COMMENT=77
78+
LINE_COMMENT=78
79+
WS=79
80+
SHEBANG=80
8081
';'=1
8182
'='=2
8283
'break'=3
@@ -136,11 +137,12 @@ SHEBANG=79
136137
'#'=57
137138
'^'=58
138139
'new'=59
139-
'get'=60
140-
'set'=61
141-
'constructor'=62
142-
'++'=63
143-
'+='=64
144-
'*='=65
145-
'/='=66
146-
'-='=67
140+
'static'=60
141+
'get'=61
142+
'set'=62
143+
'constructor'=63
144+
'++'=64
145+
'+='=65
146+
'*='=66
147+
'/='=67
148+
'-='=68

src/main/java/org/luapp/language/generator/luappBaseListener.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,18 @@ public class luappBaseListener implements luappListener {
491491
* <p>The default implementation does nothing.</p>
492492
*/
493493
@Override public void exitClassfunction(luappParser.ClassfunctionContext ctx) { }
494+
/**
495+
* {@inheritDoc}
496+
*
497+
* <p>The default implementation does nothing.</p>
498+
*/
499+
@Override public void enterClassstaticfunction(luappParser.ClassstaticfunctionContext ctx) { }
500+
/**
501+
* {@inheritDoc}
502+
*
503+
* <p>The default implementation does nothing.</p>
504+
*/
505+
@Override public void exitClassstaticfunction(luappParser.ClassstaticfunctionContext ctx) { }
494506
/**
495507
* {@inheritDoc}
496508
*

src/main/java/org/luapp/language/generator/luappBaseVisitor.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,13 @@ public class luappBaseVisitor<T> extends AbstractParseTreeVisitor<T> implements
291291
* {@link #visitChildren} on {@code ctx}.</p>
292292
*/
293293
@Override public T visitClassfunction(luappParser.ClassfunctionContext ctx) { return visitChildren(ctx); }
294+
/**
295+
* {@inheritDoc}
296+
*
297+
* <p>The default implementation returns the result of calling
298+
* {@link #visitChildren} on {@code ctx}.</p>
299+
*/
300+
@Override public T visitClassstaticfunction(luappParser.ClassstaticfunctionContext ctx) { return visitChildren(ctx); }
294301
/**
295302
* {@inheritDoc}
296303
*

src/main/java/org/luapp/language/generator/luappLexer.interp

Lines changed: 4 additions & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)