Skip to content

Commit

Permalink
Removes the new Keyword until we can find a better way to implement.
Browse files Browse the repository at this point in the history
  • Loading branch information
NoSharp committed Jun 12, 2020
1 parent 1ae48c3 commit e3603c0
Show file tree
Hide file tree
Showing 20 changed files with 881 additions and 1,064 deletions.
16 changes: 16 additions & 0 deletions .idea/misc.xml

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

13 changes: 7 additions & 6 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 Down Expand Up @@ -96,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
12 changes: 0 additions & 12 deletions src/main/java/org/luapp/language/generator/luappBaseListener.java
Original file line number Diff line number Diff line change
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
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.

481 changes: 239 additions & 242 deletions src/main/java/org/luapp/language/generator/luappLexer.java

Large diffs are not rendered by default.

44 changes: 21 additions & 23 deletions src/main/java/org/luapp/language/generator/luappLexer.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
10 changes: 0 additions & 10 deletions src/main/java/org/luapp/language/generator/luappListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -377,16 +377,6 @@ public interface luappListener extends ParseTreeListener {
* @param ctx the parse tree
*/
void exitString(luappParser.StringContext ctx);
/**
* Enter a parse tree produced by {@link luappParser#newclass}.
* @param ctx the parse tree
*/
void enterNewclass(luappParser.NewclassContext ctx);
/**
* Exit a parse tree produced by {@link luappParser#newclass}.
* @param ctx the parse tree
*/
void exitNewclass(luappParser.NewclassContext ctx);
/**
* Enter a parse tree produced by {@link luappParser#classdef}.
* @param ctx the parse tree
Expand Down
Loading

0 comments on commit e3603c0

Please sign in to comment.