Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea/**/**
.idea/modules.xml
target/**
.idea/vcs.xml
2 changes: 1 addition & 1 deletion .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 10 additions & 7 deletions src/main/java/org/luapp/language/Luapp.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public class Luapp {
public String currentClass;
public String currentAbstract;

public CommonTokenStream commonTokenStream;

/**
*
* @param path The path to the file.
Expand All @@ -42,8 +44,8 @@ public void load(){
this.listenerManager = new ListenerManager();
this.listenerManager.Load();
luappLexer lexer = new luappLexer(new ANTLRFileStream(this.path));
CommonTokenStream tokens = new CommonTokenStream(lexer);
luappParser parser = new luappParser(tokens);
this.commonTokenStream = new CommonTokenStream(lexer);
luappParser parser = new luappParser(this.commonTokenStream);
ParseTree tree = parser.chunk();
ParseTreeWalker walker = new ParseTreeWalker();
walker.walk(new MasterLuaPPListener(), tree);
Expand All @@ -52,7 +54,9 @@ public void load(){
File newFile = new File(newPath);
newFile.createNewFile();
FileWriter writeFile = new FileWriter(newPath);
writeFile.write("--[[\nWritten by nosharp (https://nosharp.cc),\ntom.bat (tomdotbat.dev),\nsamuel milton (smilton.dev)\n]]--" + this.currentResult);
writeFile.write("--[[\nWritten with Lua++.\n" +
"Don't remove this notice please\n" +
"\nhttps://github.com/LuaPlusPlus/lua-plus-plus\n]]--" + this.currentResult);
writeFile.close();
}catch(IOException ex){
ex.printStackTrace();
Expand Down Expand Up @@ -94,10 +98,9 @@ public String getRaw(){
}

public String getRawFromContext(ParserRuleContext context){
Token startToken = context.start;
Token stopToken = context.stop;
CharStream cs = context.start.getTokenSource().getInputStream();
return cs.getText(new Interval(startToken.getStartIndex(), stopToken.getStopIndex()));
int startToken = context.start.getStartIndex();
int stopToken = context.stop.getStartIndex();
return context.getStart().getInputStream().getText(new Interval(startToken, stopToken));
}

public void appendToResult(String target){
Expand Down
5 changes: 1 addition & 4 deletions src/main/java/org/luapp/language/generator/luapp.interp

Large diffs are not rendered by default.

44 changes: 21 additions & 23 deletions src/main/java/org/luapp/language/generator/luapp.tokens
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,18 @@ T__63=64
T__64=65
T__65=66
T__66=67
T__67=68
NAME=69
NORMALSTRING=70
CHARSTRING=71
LONGSTRING=72
INT=73
HEX=74
FLOAT=75
HEX_FLOAT=76
COMMENT=77
LINE_COMMENT=78
WS=79
SHEBANG=80
NAME=68
NORMALSTRING=69
CHARSTRING=70
LONGSTRING=71
INT=72
HEX=73
FLOAT=74
HEX_FLOAT=75
COMMENT=76
LINE_COMMENT=77
WS=78
SHEBANG=79
';'=1
'='=2
'break'=3
Expand Down Expand Up @@ -136,13 +135,12 @@ SHEBANG=80
'not'=56
'#'=57
'^'=58
'new'=59
'static'=60
'get'=61
'set'=62
'constructor'=63
'++'=64
'+='=65
'*='=66
'/='=67
'-='=68
'static'=59
'get'=60
'set'=61
'constructor'=62
'++'=63
'+='=64
'*='=65
'/='=66
'-='=67
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated from C:/Users/Harry/Desktop/Lua/lua-plus-plus/src/main/java/org/luapp/language/parser\luapp.g4 by ANTLR 4.8
// Generated from C:/Users/Harry/Desktop/Lua/lpp2electricboogaloo/lua-plus-plus/src/main/java/org/luapp/language/parser\luapp.g4 by ANTLR 4.8
package org.luapp.language.generator;

import org.antlr.v4.runtime.ParserRuleContext;
Expand Down Expand Up @@ -455,18 +455,6 @@ public class luappBaseListener implements luappListener {
* <p>The default implementation does nothing.</p>
*/
@Override public void exitString(luappParser.StringContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterNewclass(luappParser.NewclassContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitNewclass(luappParser.NewclassContext ctx) { }
/**
* {@inheritDoc}
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated from C:/Users/Harry/Desktop/Lua/lua-plus-plus/src/main/java/org/luapp/language/parser\luapp.g4 by ANTLR 4.8
// Generated from C:/Users/Harry/Desktop/Lua/lpp2electricboogaloo/lua-plus-plus/src/main/java/org/luapp/language/parser\luapp.g4 by ANTLR 4.8
package org.luapp.language.generator;
import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor;

Expand Down Expand Up @@ -270,13 +270,6 @@ public class luappBaseVisitor<T> extends AbstractParseTreeVisitor<T> implements
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitString(luappParser.StringContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitNewclass(luappParser.NewclassContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
Expand Down
5 changes: 1 addition & 4 deletions src/main/java/org/luapp/language/generator/luappLexer.interp

Large diffs are not rendered by default.

Loading