Skip to content

Commit 17eabae

Browse files
authored
Merge pull request #28 from LuaPlusPlus/1.0.5
1.0.5
2 parents 472817c + e3603c0 commit 17eabae

24 files changed

+871
-1051
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.idea/**/**
22
.idea/modules.xml
33
target/**
4+
.idea/vcs.xml

.idea/compiler.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 2 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ public class Luapp {
2626
public String currentClass;
2727
public String currentAbstract;
2828

29+
public CommonTokenStream commonTokenStream;
30+
2931
/**
3032
*
3133
* @param path The path to the file.
@@ -42,8 +44,8 @@ public void load(){
4244
this.listenerManager = new ListenerManager();
4345
this.listenerManager.Load();
4446
luappLexer lexer = new luappLexer(new ANTLRFileStream(this.path));
45-
CommonTokenStream tokens = new CommonTokenStream(lexer);
46-
luappParser parser = new luappParser(tokens);
47+
this.commonTokenStream = new CommonTokenStream(lexer);
48+
luappParser parser = new luappParser(this.commonTokenStream);
4749
ParseTree tree = parser.chunk();
4850
ParseTreeWalker walker = new ParseTreeWalker();
4951
walker.walk(new MasterLuaPPListener(), tree);
@@ -52,7 +54,9 @@ public void load(){
5254
File newFile = new File(newPath);
5355
newFile.createNewFile();
5456
FileWriter writeFile = new FileWriter(newPath);
55-
writeFile.write("--[[\nWritten by nosharp (https://nosharp.cc),\ntom.bat (tomdotbat.dev),\nsamuel milton (smilton.dev)\n]]--" + this.currentResult);
57+
writeFile.write("--[[\nWritten with Lua++.\n" +
58+
"Don't remove this notice please\n" +
59+
"\nhttps://github.com/LuaPlusPlus/lua-plus-plus\n]]--" + this.currentResult);
5660
writeFile.close();
5761
}catch(IOException ex){
5862
ex.printStackTrace();
@@ -94,10 +98,9 @@ public String getRaw(){
9498
}
9599

96100
public String getRawFromContext(ParserRuleContext context){
97-
Token startToken = context.start;
98-
Token stopToken = context.stop;
99-
CharStream cs = context.start.getTokenSource().getInputStream();
100-
return cs.getText(new Interval(startToken.getStartIndex(), stopToken.getStopIndex()));
101+
int startToken = context.start.getStartIndex();
102+
int stopToken = context.stop.getStartIndex();
103+
return context.getStart().getInputStream().getText(new Interval(startToken, stopToken));
101104
}
102105

103106
public void appendToResult(String target){

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

Lines changed: 1 addition & 4 deletions
Large diffs are not rendered by default.

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

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,18 @@ T__63=64
6565
T__64=65
6666
T__65=66
6767
T__66=67
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
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
8180
';'=1
8281
'='=2
8382
'break'=3
@@ -136,13 +135,12 @@ SHEBANG=80
136135
'not'=56
137136
'#'=57
138137
'^'=58
139-
'new'=59
140-
'static'=60
141-
'get'=61
142-
'set'=62
143-
'constructor'=63
144-
'++'=64
145-
'+='=65
146-
'*='=66
147-
'/='=67
148-
'-='=68
138+
'static'=59
139+
'get'=60
140+
'set'=61
141+
'constructor'=62
142+
'++'=63
143+
'+='=64
144+
'*='=65
145+
'/='=66
146+
'-='=67

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

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Generated from C:/Users/Harry/Desktop/Lua/lua-plus-plus/src/main/java/org/luapp/language/parser\luapp.g4 by ANTLR 4.8
1+
// Generated from C:/Users/Harry/Desktop/Lua/lpp2electricboogaloo/lua-plus-plus/src/main/java/org/luapp/language/parser\luapp.g4 by ANTLR 4.8
22
package org.luapp.language.generator;
33

44
import org.antlr.v4.runtime.ParserRuleContext;
@@ -455,18 +455,6 @@ public class luappBaseListener implements luappListener {
455455
* <p>The default implementation does nothing.</p>
456456
*/
457457
@Override public void exitString(luappParser.StringContext ctx) { }
458-
/**
459-
* {@inheritDoc}
460-
*
461-
* <p>The default implementation does nothing.</p>
462-
*/
463-
@Override public void enterNewclass(luappParser.NewclassContext ctx) { }
464-
/**
465-
* {@inheritDoc}
466-
*
467-
* <p>The default implementation does nothing.</p>
468-
*/
469-
@Override public void exitNewclass(luappParser.NewclassContext ctx) { }
470458
/**
471459
* {@inheritDoc}
472460
*

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

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Generated from C:/Users/Harry/Desktop/Lua/lua-plus-plus/src/main/java/org/luapp/language/parser\luapp.g4 by ANTLR 4.8
1+
// Generated from C:/Users/Harry/Desktop/Lua/lpp2electricboogaloo/lua-plus-plus/src/main/java/org/luapp/language/parser\luapp.g4 by ANTLR 4.8
22
package org.luapp.language.generator;
33
import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor;
44

@@ -270,13 +270,6 @@ public class luappBaseVisitor<T> extends AbstractParseTreeVisitor<T> implements
270270
* {@link #visitChildren} on {@code ctx}.</p>
271271
*/
272272
@Override public T visitString(luappParser.StringContext ctx) { return visitChildren(ctx); }
273-
/**
274-
* {@inheritDoc}
275-
*
276-
* <p>The default implementation returns the result of calling
277-
* {@link #visitChildren} on {@code ctx}.</p>
278-
*/
279-
@Override public T visitNewclass(luappParser.NewclassContext ctx) { return visitChildren(ctx); }
280273
/**
281274
* {@inheritDoc}
282275
*

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

Lines changed: 1 addition & 4 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)