Skip to content

Commit 238eab9

Browse files
committed
Fixes statements being duplicated in "block" parents.
1 parent 5ba2188 commit 238eab9

File tree

7 files changed

+24
-82
lines changed

7 files changed

+24
-82
lines changed

.gitignore

Lines changed: 3 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,3 @@
1-
2-
# User-specific stuff
3-
.idea/**/workspace.xml
4-
.idea/**/tasks.xml
5-
.idea/**/usage.statistics.xml
6-
.idea/**/dictionaries
7-
.idea/**/shelf
8-
9-
# Generated files
10-
.idea/**/contentModel.xml
11-
12-
# Sensitive or high-churn files
13-
.idea/**/dataSources/
14-
.idea/**/dataSources.ids
15-
.idea/**/dataSources.local.xml
16-
.idea/**/sqlDataSources.xml
17-
.idea/**/dynamic.xml
18-
.idea/**/uiDesigner.xml
19-
.idea/**/dbnavigator.xml
20-
21-
# Gradle
22-
.idea/**/gradle.xml
23-
.idea/**/libraries
24-
25-
# Gradle and Maven with auto-import
26-
# When using Gradle or Maven with auto-import, you should exclude module files,
27-
# since they will be recreated, and may cause churn. Uncomment if using
28-
# auto-import.
29-
# .idea/artifacts
30-
# .idea/compiler.xml
31-
# .idea/jarRepositories.xml
32-
# .idea/modules.xml
33-
# .idea/*.iml
34-
# .idea/modules
35-
# *.iml
36-
# *.ipr
37-
38-
# CMake
39-
cmake-build-*/
40-
41-
# Mongo Explorer plugin
42-
.idea/**/mongoSettings.xml
43-
44-
# File-based project format
45-
*.iws
46-
47-
# IntelliJ
48-
out/
49-
50-
# mpeltonen/sbt-idea plugin
51-
.idea_modules/
52-
53-
# JIRA plugin
54-
atlassian-ide-plugin.xml
55-
56-
# Cursive Clojure plugin
57-
.idea/replstate.xml
58-
59-
# Crashlytics plugin (for Android Studio and IntelliJ)
60-
com_crashlytics_export_strings.xml
61-
crashlytics.properties
62-
crashlytics-build.properties
63-
fabric.properties
64-
65-
# Editor-based Rest Client
66-
.idea/httpRequests
67-
68-
# Android studio 3.1+ serialized cache file
69-
.idea/caches/build_file_checksums.ser
1+
.idea/**/**
2+
.idea/modules.xml
3+
target/**

pom.xml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@
1919
<!-- https://mvnrepository.com/artifact/org.antlr/antlr4-runtime -->
2020
<dependency>
2121
<groupId>org.antlr</groupId>
22-
<artifactId>antlr-runtime</artifactId>
23-
<version>3.5.2</version>
22+
<artifactId>antlr4-runtime</artifactId>
23+
<version>4.8-1</version>
2424
</dependency>
25+
2526
<dependency>
2627
<groupId>org.antlr</groupId>
2728
<artifactId>antlr</artifactId>
@@ -50,16 +51,18 @@
5051
</plugin>
5152

5253
<plugin>
53-
<groupId>org.apache.maven.plugins</groupId>
5454
<artifactId>maven-assembly-plugin</artifactId>
55-
<version>3.1.1</version>
56-
55+
<version>2.2-beta-5</version>
5756
<configuration>
57+
<archive>
58+
<manifest>
59+
<mainClass>org.luapp.language.Main</mainClass>
60+
</manifest>
61+
</archive>
5862
<descriptorRefs>
5963
<descriptorRef>jar-with-dependencies</descriptorRef>
6064
</descriptorRefs>
6165
</configuration>
62-
6366
<executions>
6467
<execution>
6568
<id>make-assembly</id>
@@ -69,7 +72,6 @@
6972
</goals>
7073
</execution>
7174
</executions>
72-
7375
</plugin>
7476
</plugins>
7577
</build>

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ public class Main {
1010

1111
public static String output = "";
1212

13+
public static boolean debug = true;
14+
1315
public static void main(String[] args){
14-
String path = args[0];
16+
String path = debug ? System.getProperty("user.dir") + "/src/main/java/org/luapp/language/test.lpp" : args[0];
1517
Main.luaPPInstance = new Luapp(path);
1618
Main.luaPPInstance.load();
1719
}

src/main/java/org/luapp/language/handlers/StatementHandler.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ public boolean isParentClass(ParserRuleContext context){
2020
ParserRuleContext prc = (ParserRuleContext)parent;
2121
if(prc == null) return false;
2222
if(prc.parent == null) return false;
23-
if(prc.getParent().getRuleIndex() == luappParser.RULE_classbody) {
23+
if(prc.getParent().getRuleIndex() == luappParser.RULE_classbody
24+
|| prc.getParent().getRuleIndex() == luappParser.RULE_block) {
2425
return true;
2526
}
2627
parent = prc.parent;

src/main/java/org/luapp/language/test.lpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ class cat extends animal
1818
end
1919

2020
print("hello world?")
21+
if 1==1 then print("helloworld2") end

src/main/java/org/luapp/language/test.lua

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
--[[
2-
Written by nosharp (https://nosharp.cc),
3-
tom.bat (tomdotbat.dev),
4-
samuel milton (smilton.dev)
2+
Written with Lua++.
3+
Don't remove this notice please
4+
5+
https://github.com/LuaPlusPlus/lua-plus-plus
56
]]--
67
cat = {}
78
cat.__index = cat
@@ -36,4 +37,5 @@ end
3637
function cat:getType()
3738
return self.type
3839
end
39-
print("hello world?")
40+
print("hello world?")
41+
if 1==1 then print("helloworld2") end

0 commit comments

Comments
 (0)