diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 000000000..1bec35e57
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
new file mode 100644
index 000000000..79ee123c2
--- /dev/null
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index a1c50656f..9d225e1e8 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -19,7 +19,7 @@
-
+
\ No newline at end of file
diff --git a/compiler/src/prog8/compiler/ErrorReporter.kt b/compiler/src/prog8/compiler/ErrorReporter.kt
index fdd893232..2dc864133 100644
--- a/compiler/src/prog8/compiler/ErrorReporter.kt
+++ b/compiler/src/prog8/compiler/ErrorReporter.kt
@@ -32,7 +32,7 @@ internal class ErrorReporter: IErrorReporter {
MessageSeverity.ERROR -> printer.print("\u001b[91m") // bright red
MessageSeverity.WARNING -> printer.print("\u001b[93m") // bright yellow
}
- val msg = "${it.position.toClickableStr()} ${it.severity} ${it.message}".trim()
+ val msg = "${it.severity} ${it.position.toClickableStr()} ${it.message}".trim()
if(msg !in alreadyReportedMessages) {
printer.println(msg)
alreadyReportedMessages.add(msg)
diff --git a/compiler/test/ModuleImporterTests.kt b/compiler/test/ModuleImporterTests.kt
index 7a1e66f24..f1c8fe56b 100644
--- a/compiler/test/ModuleImporterTests.kt
+++ b/compiler/test/ModuleImporterTests.kt
@@ -209,14 +209,14 @@ class TestModuleImporter: FunSpec({
val result = importer.importLibraryModule(filenameNoExt)
withClue(count[n] + " call / NO .p8 extension") { result shouldBe null }
withClue(count[n] + " call / NO .p8 extension") { errors.noErrors() shouldBe false }
- errors.errors.single() shouldContain "0:0: no module found with name i_do_not_exist"
+ errors.errors.single() shouldContain "0:0) no module found with name i_do_not_exist"
errors.report()
program.modules.size shouldBe 1
val result2 = importer.importLibraryModule(filenameWithExt)
withClue(count[n] + " call / with .p8 extension") { result2 shouldBe null }
withClue(count[n] + " call / with .p8 extension") { importer.errors.noErrors() shouldBe false }
- errors.errors.single() shouldContain "0:0: no module found with name i_do_not_exist.p8"
+ errors.errors.single() shouldContain "0:0) no module found with name i_do_not_exist.p8"
errors.report()
program.modules.size shouldBe 1
}
diff --git a/compiler/test/TestCompilerOnRanges.kt b/compiler/test/TestCompilerOnRanges.kt
index 5bc2e3dfa..401018f11 100644
--- a/compiler/test/TestCompilerOnRanges.kt
+++ b/compiler/test/TestCompilerOnRanges.kt
@@ -229,8 +229,8 @@ class TestCompilerOnRanges: FunSpec({
}
""", errors, false).assertFailure()
errors.errors.size shouldBe 2
- errors.errors[0] shouldContain ".p8:5:29: range expression from value must be integer"
- errors.errors[1] shouldContain ".p8:5:44: range expression to value must be integer"
+ errors.errors[0] shouldContain ".p8:5:30) range expression from value must be integer"
+ errors.errors[1] shouldContain ".p8:5:45) range expression to value must be integer"
}
test("testForLoopWithIterable_str") {
diff --git a/compiler/test/TestSubroutines.kt b/compiler/test/TestSubroutines.kt
index 19967f565..d7082b36b 100644
--- a/compiler/test/TestSubroutines.kt
+++ b/compiler/test/TestSubroutines.kt
@@ -148,7 +148,7 @@ class TestSubroutines: FunSpec({
val errors = ErrorReporterForTests()
compileText(C64Target, false, text, errors, false).assertFailure("currently array dt in signature is invalid") // TODO should not be invalid?
errors.warnings.size shouldBe 0
- errors.errors.single() shouldContain ".p8:9:16: Non-string pass-by-reference types cannot occur as a parameter type directly"
+ errors.errors.single() shouldContain ".p8:9:17) Non-string pass-by-reference types cannot occur as a parameter type directly"
}
// TODO allow this?
@@ -281,8 +281,8 @@ class TestSubroutines: FunSpec({
val errors = ErrorReporterForTests()
compileText(C64Target, false, text, writeAssembly = false, errors=errors).assertFailure()
errors.errors.size shouldBe 2
- errors.errors[0] shouldContain "7:24: invalid number of arguments"
- errors.errors[1] shouldContain "9:24: invalid number of arguments"
+ errors.errors[0] shouldContain "7:25) invalid number of arguments"
+ errors.errors[1] shouldContain "9:25) invalid number of arguments"
}
test("invalid number of args check on asm subroutine") {
@@ -302,8 +302,8 @@ class TestSubroutines: FunSpec({
val errors = ErrorReporterForTests()
compileText(C64Target, false, text, writeAssembly = false, errors=errors).assertFailure()
errors.errors.size shouldBe 2
- errors.errors[0] shouldContain "7:24: invalid number of arguments"
- errors.errors[1] shouldContain "9:24: invalid number of arguments"
+ errors.errors[0] shouldContain "7:25) invalid number of arguments"
+ errors.errors[1] shouldContain "9:25) invalid number of arguments"
}
test("invalid number of args check on call to label and builtin func") {
diff --git a/compilerAst/src/prog8/ast/antlr/Antlr2Kotlin.kt b/compilerAst/src/prog8/ast/antlr/Antlr2Kotlin.kt
index ff673fd17..1f1378495 100644
--- a/compilerAst/src/prog8/ast/antlr/Antlr2Kotlin.kt
+++ b/compilerAst/src/prog8/ast/antlr/Antlr2Kotlin.kt
@@ -29,7 +29,7 @@ private fun ParserRuleContext.toPosition() : Position {
pathString
}
// note: beware of TAB characters in the source text, they count as 1 column...
- return Position(filename, start.line, start.charPositionInLine, start.charPositionInLine + start.stopIndex - start.startIndex)
+ return Position(filename, start.line, start.charPositionInLine+1, start.charPositionInLine + 1 + start.stopIndex - start.startIndex)
}
internal fun Prog8ANTLRParser.BlockContext.toAst(isInLibrary: Boolean) : Block {
diff --git a/compilerAst/src/prog8/ast/base/Base.kt b/compilerAst/src/prog8/ast/base/Base.kt
index 066c7df57..a44579d15 100644
--- a/compilerAst/src/prog8/ast/base/Base.kt
+++ b/compilerAst/src/prog8/ast/base/Base.kt
@@ -1,6 +1,8 @@
package prog8.ast.base
import prog8.ast.Node
+import kotlin.io.path.Path
+import kotlin.io.path.absolute
/**************************** AST Data classes ****************************/
@@ -187,7 +189,7 @@ object ParentSentinel : Node {
data class Position(val file: String, val line: Int, val startCol: Int, val endCol: Int) {
override fun toString(): String = "[$file: line $line col ${startCol+1}-${endCol+1}]"
- fun toClickableStr(): String = "$file:$line:$startCol:"
+ fun toClickableStr(): String = "(${Path("").absolute()}/$file:$line:$startCol)"
companion object {
val DUMMY = Position("", 0, 0, 0)
diff --git a/compilerAst/test/TestProg8Parser.kt b/compilerAst/test/TestProg8Parser.kt
index 42a171119..b8e160693 100644
--- a/compilerAst/test/TestProg8Parser.kt
+++ b/compilerAst/test/TestProg8Parser.kt
@@ -296,9 +296,9 @@ class TestProg8Parser: FunSpec( {
val mpf = module.position.file
assertPositionOf(module, SourceCode.relative(path).toString(), 1, 0)
val mainBlock = module.statements.filterIsInstance()[0]
- assertPositionOf(mainBlock, mpf, 2, 0, 3)
+ assertPositionOf(mainBlock, mpf, 2, 1, 4)
val startSub = mainBlock.statements.filterIsInstance()[0]
- assertPositionOf(startSub, mpf, 3, 4, 6)
+ assertPositionOf(startSub, mpf, 3, 5, 7)
}
test("of non-root Nodes parsed from a string") {
@@ -320,22 +320,22 @@ class TestProg8Parser: FunSpec( {
val mpf = module.position.file
val targetDirective = module.statements.filterIsInstance()[0]
- assertPositionOf(targetDirective, mpf, 1, 0, 8)
+ assertPositionOf(targetDirective, mpf, 1, 1, 9)
val mainBlock = module.statements.filterIsInstance()[0]
- assertPositionOf(mainBlock, mpf, 2, 0, 3)
+ assertPositionOf(mainBlock, mpf, 2, 1, 4)
val startSub = mainBlock.statements.filterIsInstance()[0]
- assertPositionOf(startSub, mpf, 3, 4, 6)
+ assertPositionOf(startSub, mpf, 3, 5, 7)
val declFoo = startSub.statements.filterIsInstance()[0]
- assertPositionOf(declFoo, mpf, 4, 8, 12)
+ assertPositionOf(declFoo, mpf, 4, 9, 13)
val rhsFoo = declFoo.value!!
- assertPositionOf(rhsFoo, mpf, 4, 20, 21)
+ assertPositionOf(rhsFoo, mpf, 4, 21, 22)
val declBar = startSub.statements.filterIsInstance()[1]
- assertPositionOf(declBar, mpf, 5, 8, 12)
+ assertPositionOf(declBar, mpf, 5, 9, 13)
val whenStmt = startSub.statements.filterIsInstance()[0]
- assertPositionOf(whenStmt, mpf, 6, 8, 11)
- assertPositionOf(whenStmt.choices[0], mpf, 7, 12, 13)
- assertPositionOf(whenStmt.choices[1], mpf, 8, 12, 13)
- assertPositionOf(whenStmt.choices[2], mpf, 9, 12, 15)
+ assertPositionOf(whenStmt, mpf, 6, 9, 12)
+ assertPositionOf(whenStmt.choices[0], mpf, 7, 13, 14)
+ assertPositionOf(whenStmt.choices[1], mpf, 8, 13, 14)
+ assertPositionOf(whenStmt.choices[2], mpf, 9, 13, 16)
}
}
diff --git a/docs/docs.iml b/docs/docs.iml
index cc5eb432c..2048969ce 100644
--- a/docs/docs.iml
+++ b/docs/docs.iml
@@ -5,7 +5,7 @@
-
+
\ No newline at end of file
diff --git a/syntax-files/IDEA/readme.txt b/syntax-files/IDEA/readme.txt
index 3ca8f5f0f..688862871 100644
--- a/syntax-files/IDEA/readme.txt
+++ b/syntax-files/IDEA/readme.txt
@@ -1,11 +1,11 @@
Prog8 syntax highlighting file for IntelliJ IDEA.
Copy the file Prog8.xml to your IDEA filetypes folder.
+If this folder doesn't yet exist, simply create it.
+After installing this file, restart the IDEA.
-The exact path may vary with the version of the IDE,
-but for me it is currently this on Linux:
+The exact location of the folder varies per operating system and
+IDE version, but for me it is currently this on Linux:
-$HOME/.config/JetBrains/IntelliJIdea2020.2/filetypes/
+ $HOME/.config/JetBrains/IntelliJIdea2021.3/filetypes/
-
-(note the version number in the path, adjust accordingly)