Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Internal language parser is not found in xtext project( org.eclipse.xtext.util.RuntimeIOException: java.io.FileNotFoundException: C:\Users\Udeshika\workspace\org.example.siddhi\..\org.example.siddhi.ide\src-gen\org\xtext\example\siddhiql\ide\contentassist)
Internal language parser is not found in xtext project [message #1764235] Sat, 27 May 2017 03:47 Go to next message
Udeshika Sewwandi is currently offline Udeshika SewwandiFriend
Messages: 118
Registered: March 2017
Senior Member
When I am trying to convert an Antlr written grammar file to Xtext some times it complains with this error when generating xtext artifacts. My grammar file is a bit large and once it gave a heap memory error and I allocated 1024MB for heap. Is the above mentioned error occurred due to false conversions? But I feel the conversions should be fine.
For instance an antlr written rule like
partition
: annotation* PARTITION WITH '('partition_with_stream (','partition_with_stream)* ')' BEGIN (query|error) (';' (query|error))* ';'? END
;

should be converted in the same way to Xtext grammar as far as I know. Does anyone having an idea why this error is coming?

The whole error is:
[main] ERROR mf.mwe2.launch.runtime.Mwe2Launcher - Problems running workflow org.xtext.example.siddhiql.GenerateSiddhiQL:
[ERROR]: GeneratorException: (Element: -UNKNOWN-; Reported by: XtextGenerator)
org.eclipse.xtext.util.RuntimeIOException: java.io.FileNotFoundException: C:\Users\Udeshika\workspace\org.example.siddhi\..\org.example.siddhi.ide\src-gen\org\xtext\example\siddhiql\ide\contentassist\antlr\internal\InternalSiddhiQLParser.java (The system cannot find the file specified)
at org.eclipse.xtext.generator.JavaIoFileSystemAccess.readTextFile(JavaIoFileSystemAccess.java:257)
at org.eclipse.xtext.generator.AbstractFileSystemAccess2.readTextFile(AbstractFileSystemAccess2.java:45)
at org.eclipse.xtext.xtext.generator.parser.antlr.AbstractAntlrGeneratorFragment2.improveCodeQuality(AbstractAntlrGeneratorFragment2.java:225)
at org.eclipse.xtext.xtext.generator.parser.antlr.AbstractAntlrGeneratorFragment2.splitParserAndLexerIfEnabled(AbstractAntlrGeneratorFragment2.java:213)
at org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2.generateContentAssistGrammar(XtextAntlrGeneratorFragment2.java:199)
at org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2.doGenerate(XtextAntlrGeneratorFragment2.java:156)
at org.eclipse.xtext.xtext.generator.parser.antlr.AbstractAntlrGeneratorFragment2.generate(AbstractAntlrGeneratorFragment2.java:109)
at org.eclipse.xtext.xtext.generator.CompositeGeneratorFragment2.generate(CompositeGeneratorFragment2.java:48)
at org.eclipse.xtext.xtext.generator.XtextGenerator.invokeInternal(XtextGenerator.java:212)
at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:126)
at org.eclipse.emf.mwe.core.lib.Mwe2Bridge.invoke(Mwe2Bridge.java:34)
at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:201)
at org.eclipse.emf.mwe2.runtime.workflow.AbstractCompositeWorkflowComponent.invoke(AbstractCompositeWorkflowComponent.java:35)
at org.eclipse.emf.mwe2.runtime.workflow.Workflow.run(Workflow.java:19)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:102)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:62)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:52)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:78)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:36)
Caused by: java.io.FileNotFoundException: C:\Users\Udeshika\workspace\org.example.siddhi\..\org.example.siddhi.ide\src-gen\org\xtext\example\siddhiql\ide\contentassist\antlr\internal\InternalSiddhiQLParser.java (The system cannot find the file specified)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at com.google.common.io.Files$FileByteSource.openStream(Files.java:127)
at com.google.common.io.Files$FileByteSource.openStream(Files.java:117)
at com.google.common.io.ByteSource.read(ByteSource.java:265)
at com.google.common.io.Files$FileByteSource.read(Files.java:144)
at com.google.common.io.Files.toByteArray(Files.java:377)
at org.eclipse.xtext.generator.JavaIoFileSystemAccess.readTextFile(JavaIoFileSystemAccess.java:253)
... 18 more

java.lang.RuntimeException: Problems running workflow org.xtext.example.siddhiql.GenerateSiddhiQL:
[ERROR]: GeneratorException: (Element: -UNKNOWN-; Reported by: XtextGenerator)
org.eclipse.xtext.util.RuntimeIOException: java.io.FileNotFoundException: C:\Users\Udeshika\workspace\org.example.siddhi\..\org.example.siddhi.ide\src-gen\org\xtext\example\siddhiql\ide\contentassist\antlr\internal\InternalSiddhiQLParser.java (The system cannot find the file specified)
at org.eclipse.xtext.generator.JavaIoFileSystemAccess.readTextFile(JavaIoFileSystemAccess.java:257)
at org.eclipse.xtext.generator.AbstractFileSystemAccess2.readTextFile(AbstractFileSystemAccess2.java:45)
at org.eclipse.xtext.xtext.generator.parser.antlr.AbstractAntlrGeneratorFragment2.improveCodeQuality(AbstractAntlrGeneratorFragment2.java:225)
at org.eclipse.xtext.xtext.generator.parser.antlr.AbstractAntlrGeneratorFragment2.splitParserAndLexerIfEnabled(AbstractAntlrGeneratorFragment2.java:213)
at org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2.generateContentAssistGrammar(XtextAntlrGeneratorFragment2.java:199)
at org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2.doGenerate(XtextAntlrGeneratorFragment2.java:156)
at org.eclipse.xtext.xtext.generator.parser.antlr.AbstractAntlrGeneratorFragment2.generate(AbstractAntlrGeneratorFragment2.java:109)
at org.eclipse.xtext.xtext.generator.CompositeGeneratorFragment2.generate(CompositeGeneratorFragment2.java:48)
at org.eclipse.xtext.xtext.generator.XtextGenerator.invokeInternal(XtextGenerator.java:212)
at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:126)
at org.eclipse.emf.mwe.core.lib.Mwe2Bridge.invoke(Mwe2Bridge.java:34)
at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:201)
at org.eclipse.emf.mwe2.runtime.workflow.AbstractCompositeWorkflowComponent.invoke(AbstractCompositeWorkflowComponent.java:35)
at org.eclipse.emf.mwe2.runtime.workflow.Workflow.run(Workflow.java:19)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:102)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:62)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:52)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:78)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:36)
Caused by: java.io.FileNotFoundException: C:\Users\Udeshika\workspace\org.example.siddhi\..\org.example.siddhi.ide\src-gen\org\xtext\example\siddhiql\ide\contentassist\antlr\internal\InternalSiddhiQLParser.java (The system cannot find the file specified)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at com.google.common.io.Files$FileByteSource.openStream(Files.java:127)
at com.google.common.io.Files$FileByteSource.openStream(Files.java:117)
at com.google.common.io.ByteSource.read(ByteSource.java:265)
at com.google.common.io.Files$FileByteSource.read(Files.java:144)
at com.google.common.io.Files.toByteArray(Files.java:377)
at org.eclipse.xtext.generator.JavaIoFileSystemAccess.readTextFile(JavaIoFileSystemAccess.java:253)
... 18 more

at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:104)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:62)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:52)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:78)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:36)
Caused by: java.lang.RuntimeException:
[ERROR]: GeneratorException: (Element: -UNKNOWN-; Reported by: XtextGenerator)
org.eclipse.xtext.util.RuntimeIOException: java.io.FileNotFoundException: C:\Users\Udeshika\workspace\org.example.siddhi\..\org.example.siddhi.ide\src-gen\org\xtext\example\siddhiql\ide\contentassist\antlr\internal\InternalSiddhiQLParser.java (The system cannot find the file specified)
at org.eclipse.xtext.generator.JavaIoFileSystemAccess.readTextFile(JavaIoFileSystemAccess.java:257)
at org.eclipse.xtext.generator.AbstractFileSystemAccess2.readTextFile(AbstractFileSystemAccess2.java:45)
at org.eclipse.xtext.xtext.generator.parser.antlr.AbstractAntlrGeneratorFragment2.improveCodeQuality(AbstractAntlrGeneratorFragment2.java:225)
at org.eclipse.xtext.xtext.generator.parser.antlr.AbstractAntlrGeneratorFragment2.splitParserAndLexerIfEnabled(AbstractAntlrGeneratorFragment2.java:213)
at org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2.generateContentAssistGrammar(XtextAntlrGeneratorFragment2.java:199)
at org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2.doGenerate(XtextAntlrGeneratorFragment2.java:156)
at org.eclipse.xtext.xtext.generator.parser.antlr.AbstractAntlrGeneratorFragment2.generate(AbstractAntlrGeneratorFragment2.java:109)
at org.eclipse.xtext.xtext.generator.CompositeGeneratorFragment2.generate(CompositeGeneratorFragment2.java:48)
at org.eclipse.xtext.xtext.generator.XtextGenerator.invokeInternal(XtextGenerator.java:212)
at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:126)
at org.eclipse.emf.mwe.core.lib.Mwe2Bridge.invoke(Mwe2Bridge.java:34)
at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:201)
at org.eclipse.emf.mwe2.runtime.workflow.AbstractCompositeWorkflowComponent.invoke(AbstractCompositeWorkflowComponent.java:35)
at org.eclipse.emf.mwe2.runtime.workflow.Workflow.run(Workflow.java:19)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:102)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:62)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:52)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:78)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:36)
Caused by: java.io.FileNotFoundException: C:\Users\Udeshika\workspace\org.example.siddhi\..\org.example.siddhi.ide\src-gen\org\xtext\example\siddhiql\ide\contentassist\antlr\internal\InternalSiddhiQLParser.java (The system cannot find the file specified)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at com.google.common.io.Files$FileByteSource.openStream(Files.java:127)
at com.google.common.io.Files$FileByteSource.openStream(Files.java:117)
at com.google.common.io.ByteSource.read(ByteSource.java:265)
at com.google.common.io.Files$FileByteSource.read(Files.java:144)
at com.google.common.io.Files.toByteArray(Files.java:377)
at org.eclipse.xtext.generator.JavaIoFileSystemAccess.readTextFile(JavaIoFileSystemAccess.java:253)
... 18 more

at org.eclipse.emf.mwe.core.lib.Mwe2Bridge.handleIssues(Mwe2Bridge.java:56)
at org.eclipse.emf.mwe.core.lib.Mwe2Bridge.invoke(Mwe2Bridge.java:48)
at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:201)
at org.eclipse.emf.mwe2.runtime.workflow.AbstractCompositeWorkflowComponent.invoke(AbstractCompositeWorkflowComponent.java:35)
at org.eclipse.emf.mwe2.runtime.workflow.Workflow.run(Workflow.java:19)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:102)
... 4 more
Re: Internal language parser is not found in xtext project [message #1764238 is a reply to message #1764235] Sat, 27 May 2017 05:32 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi

This could be a timeout problem
you should play around with the antlr options inside

A to be added

parserGenerator = {
antlrParam = "-Xconversiontimeout"
antlrParam = "5000"
options = {
memoize = true
}

Can I tell you what the exact Params are.
Maybe you have some in your source as well


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Internal language parser is not found in xtext project [message #1764247 is a reply to message #1764238] Sat, 27 May 2017 09:27 Go to previous messageGo to next message
Udeshika Sewwandi is currently offline Udeshika SewwandiFriend
Messages: 118
Registered: March 2017
Senior Member
Hi,

Thank you very much for your quick response.
I have already added them as follows.
parserGenerator = {
antlrParam = "-Xconversiontimeout"
antlrParam = "5000"
options = {
ignoreCase = true
backtrack=false
memoize = true
}
}
But now I have changed it like
antlrParam = "-Xconversiontimeout"
antlrParam = "10000".
It worked for some time. Now it is complaining as "The code for the static initializer is exceeding the 65535 bytes limit". Now I am working on that. I have allocated 1024MB for the heap also. Is it due to both low memory and timeout. My machine is having Windows 8, 32 bit version. Is the problem occurring due to that?
Re: Internal language parser is not found in xtext project [message #1764248 is a reply to message #1764247] Sat, 27 May 2017 09:49 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
In the options you can enable class splitting as well

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Internal language parser is not found in xtext project [message #1764253 is a reply to message #1764248] Sat, 27 May 2017 13:49 Go to previous messageGo to next message
Udeshika Sewwandi is currently offline Udeshika SewwandiFriend
Messages: 118
Registered: March 2017
Senior Member
I have changed the options as follows.
parserGenerator = {
antlrParam = "-Xconversiontimeout"
antlrParam = "30000"
options = {
ignoreCase = true
backtrack=false
memoize = true
classSplitting=true
fieldsPerClass = "100"
methodsPerClass= "500"
}
}
But still that error is coming in internal parser class.

In some solutions it says to change mwe2 file as follows.

fragment = parser.antlr.XtextAntlrGeneratorFragment {
  options = {
       backtrack = true
       classSplitting = true
       fieldsPerClass = "500" 
    }
  }
            
            
fragment = parser.antlr.XtextAntlrUiGeneratorFragment {
     options = {
      backtrack = true
      classSplitting = true
      fieldsPerClass = "500" 
   }
}


But when I put this, it complains as "Couldn't resolve reference to JvmType 'parser.antlr.XtextAntlrGeneratorFragment'". Is it same as putting the class splitting inside parserGenerator or do I need to add these two fragments also?
Re: Internal language parser is not found in xtext project [message #1764254 is a reply to message #1764253] Sat, 27 May 2017 14:09 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Try

import org.eclipse.xtext.generator.*
import org.eclipse.xtext.ui.generator.*

If you post a repro, you may get relevant help rather than a guess.

Regards

Ed Willink
Re: Internal language parser is not found in xtext project [message #1764256 is a reply to message #1764254] Sat, 27 May 2017 15:29 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
The example you shared is from a old 28x workflow

In the new one it is the parserGenerator you showed first.

You have to play around with the values to find something that suites you

Without a grammar I cannot try it myself

Which is the class with the static initializer being too big?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Internal language parser is not found in xtext project [message #1764259 is a reply to message #1764256] Sat, 27 May 2017 16:48 Go to previous messageGo to next message
Udeshika Sewwandi is currently offline Udeshika SewwandiFriend
Messages: 118
Registered: March 2017
Senior Member
Hi

The classes are org.xtext.example.siddhiql.parser.antlr.internal.InternalSiddhiQLParser and org.xtext.example.siddhiql.ide.contentassist.antlr.internal.InternalSiddhiQLParser1 which the static initializer being too big.

The grammar file is in https://github.com/udeshika-sewwandi/Siddhi/blob/master/org.example.siddhi/src/org/xtext/example/siddhiql/SiddhiQL.xtext.
I have comment out some changed left recursive grammar which gave exactly the same error I posted. I have added several rules after the last commit. But most rules are there in the file. Can you check the changed grammar have issues?
The original antlr grammar file can be found at https://github.com/wso2/siddhi/blob/master/modules/siddhi-query-compiler/src/main/antlr4/org/wso2/siddhi/query/compiler/SiddhiQL.g4
Thank you very much again.
Re: Internal language parser is not found in xtext project [message #1764262 is a reply to message #1764259] Sat, 27 May 2017 17:05 Go to previous messageGo to next message
Udeshika Sewwandi is currently offline Udeshika SewwandiFriend
Messages: 118
Registered: March 2017
Senior Member
Hi

The workflow runs fine but there's a red cross mark on the classes as shown in the figure attached in the following link.
https://drive.google.com/file/d/0B3tawRCYox59VUFXLW1fWkhrT1k/view?usp=sharing

Thank you.
Re: Internal language parser is not found in xtext project [message #1764264 is a reply to message #1764259] Sat, 27 May 2017 17:14 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
your grammar is highly ambigous. you should adress this.
this is nothing i can do for you in this context

besides this i dont get any errors regarding initializers

when i comment in sequence_source_chain then i get your error.
but

antlrParam = "-Xconversiontimeout"
antlrParam = "20000"

fixes that (dont get any error in parsers)

i dont know what else parts i need to comment in to reproduce your problem
(the ll* problems need to be fixed anyway. it breaks the parser gen as well)


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Internal language parser is not found in xtext project [message #1764265 is a reply to message #1764264] Sat, 27 May 2017 17:15 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
so can you push the "bad" grammar on a branch?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Internal language parser is not found in xtext project [message #1764305 is a reply to message #1764265] Sat, 27 May 2017 19:20 Go to previous messageGo to next message
Udeshika Sewwandi is currently offline Udeshika SewwandiFriend
Messages: 118
Registered: March 2017
Senior Member
Hi,

The issue was fixed by adding
parserGenerator = {
		         antlrParam = "-Xconversiontimeout"
    			 antlrParam = "40000"
		         options = {
				ignoreCase = true
				backtrack=true
				memoize = true
				classSplitting=true
                	fieldsPerClass = "300"
                	methodsPerClass= "800"
				}
			}


Can you provide some examples where ll* problems are there? Since I am new to antlr and xtext I need some help to proceed. Except left recursive grammar I thought other rules are more like the same in xtext as well as antlr except minor changes. Appreciate your helpful response.
Thank you very much.

[Updated on: Sat, 27 May 2017 19:22]

Report message to a moderator

Re: Internal language parser is not found in xtext project [message #1764306 is a reply to message #1764305] Sat, 27 May 2017 19:24 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Here is some basic reading on the topic https://typefox.io/parsing-expressions-with-xtext

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Internal language parser is not found in xtext project [message #1764308 is a reply to message #1764306] Sat, 27 May 2017 19:37 Go to previous messageGo to next message
Udeshika Sewwandi is currently offline Udeshika SewwandiFriend
Messages: 118
Registered: March 2017
Senior Member
Thank you very much for your resource. I already have gone through this while I was converting left recursive grammar. Can I know an instance in my grammar file where there is ambiguous grammar? What did you mean by "so can you push the "bad" grammar on a branch?" ?
Re: Internal language parser is not found in xtext project [message #1764309 is a reply to message #1764308] Sat, 27 May 2017 19:42 Go to previous messageGo to next message
Udeshika Sewwandi is currently offline Udeshika SewwandiFriend
Messages: 118
Registered: March 2017
Senior Member
Hi,
I referred to Assigned Actions section in [1] and Parsing expressions with xtext in [2] as resources while converting left recursive grammar. Are they valid resources in current context?

[1].url]https://eclipse.org/Xtext/documentation/301_grammarlanguage.html[/url]
[2].https://eclipse.org/Xtext/documentation/307_special_languages.html

[Updated on: Sat, 27 May 2017 19:46]

Report message to a moderator

Re: Internal language parser is not found in xtext project [message #1764310 is a reply to message #1764308] Sat, 27 May 2017 19:43 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Regarding the ambiguity have a look at the messages in the error log

I meant you sharing the broken grammar the one from github. Worked fine for me


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Internal language parser is not found in xtext project [message #1764314 is a reply to message #1764310] Sun, 28 May 2017 08:51 Go to previous messageGo to next message
Udeshika Sewwandi is currently offline Udeshika SewwandiFriend
Messages: 118
Registered: March 2017
Senior Member
Hi,

An error occurred as shown in figure inhttps://drive.google.com/file/d/0B3tawRCYox59Ujk5NlVkbmo5M2s/view?usp=sharing. The relevant grammar rule is as follows.
basic_source_stream_handlers:
	(basic_ss_handler += basic_source_stream_handler)+
;

Can you recheck the grammar file I shared and give some clues why this error is coming? It look a long time for me to find a solution for the error mentioned yesterday and now I am getting stuck with some other errors which I have no idea.
Re: Internal language parser is not found in xtext project [message #1764315 is a reply to message #1764314] Sun, 28 May 2017 08:54 Go to previous messageGo to next message
Udeshika Sewwandi is currently offline Udeshika SewwandiFriend
Messages: 118
Registered: March 2017
Senior Member
Hi

Another thing that I need to ask is I have converted a left recursive grammar in Antlr as follows and I want to clarify whether it is correct.

The Antlr grammar is :
math_operation
    :'('math_operation')'                         #basic_math_operation
    |null_check                                   #basic_math_operation
    |NOT math_operation                           #not_math_operation
    |math_operation (multiply='*'|devide='/'|mod='%') math_operation    #multiplication_math_operation
    |math_operation (add='+'|substract='-') math_operation              #addition_math_operation
    |math_operation (gt_eq='>='|lt_eq='<='|gt='>'|lt='<') math_operation #greaterthan_lessthan_math_operation
    |math_operation (eq='=='|not_eq='!=') math_operation                #equality_math_operation
    |math_operation IN name                       #in_math_operation
    |math_operation AND math_operation            #and_math_operation
    |math_operation OR math_operation             #or_math_operation
    |function_operation                           #basic_math_operation
    |constant_value                               #basic_math_operation
    |attribute_reference                          #basic_math_operation
    ;


The converted Xtextgrammar is:
math_operation:
	//name = name (gt_eq='>='|lt_eq='<='|gt='>'|lt='<') name1 = INT
	{math_operation} fo=function_operation                           
    |{math_operation} constant_value                               
    |{math_operation}attribute_reference 
	|{math_operation} mlo=math_logical_operation
;

math_logical_operation returns math_operation:
	{math_operation} gt_lt=math_gt_lt_operation ({math_logical_operation.left=current} (AND | OR) right=math_gt_lt_operation)*
;

math_gt_lt_operation returns math_operation:
	{math_operation} equal=math_equal_operation ({math_gt_lt_operation.left=current} (gt_eq='>='|lt_eq='<='|gt='>'|lt='<') right=math_equal_operation)*
;

math_equal_operation returns math_operation:
	{math_operation} add_sub=math_addsub_operation ({math_gt_lt_operation.left=current} (eq='=='|not_eq='!=') right=math_addsub_operation)*
;

math_addsub_operation returns math_operation:
	{math_operation} divmul=math_divmul_operation ({math_addsub_operation.left=current} (add='+'|substract='-') right=math_divmul_operation)*
;

math_divmul_operation returns math_operation:
	{math_operation} gt_lt=math_other_operations ({math_divmul_operation.left=current} (multiply='*'|devide='/'|mod='%') right=math_other_operations)*
;

math_other_operations returns math_operation:
	//'math_op'
	'('math_operation')'                         
    |null_check                                   
    |NOT math_operation 
;

[Updated on: Sun, 28 May 2017 08:56]

Report message to a moderator

Re: Internal language parser is not found in xtext project [message #1764316 is a reply to message #1764315] Sun, 28 May 2017 09:15 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
No this looks not correct the usual pattern looks like

Addition returns Expression:
Multiplication ({Addition.left=current} '+' right=Multiplication)?;

As you can see there is no unassigned at the beginning

math_addsub_operation returns math_operation:
math_divmul_operation ({math_addsub_operation.left=current} (add='+'|substract='-') right=math_divmul_operation)*
;


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Internal language parser is not found in xtext project [message #1764317 is a reply to message #1764316] Sun, 28 May 2017 09:26 Go to previous messageGo to next message
Udeshika Sewwandi is currently offline Udeshika SewwandiFriend
Messages: 118
Registered: March 2017
Senior Member
I referred to Assigned actions section of https://eclipse.org/Xtext/documentation/301_grammarlanguage.html and Construction of an AST section of https://eclipse.org/Xtext/documentation/307_special_languages.html. There they said "if you have some construct that recurses on the left hand side, you need to put it into the delegation chain according to the operator precedence. The pattern is always the same: the thing that recurses delegates to the rule with the next higher precedence". So I have followed that.

What did you mean by "As you can see there is no unassigned at the beginning"? Sorry I didn't get it :) .Can you give some advices how this rules need to be changed if not correct? Sorry for troubling I'm truly stucked since I'm new to Xtext framework. Thank you very much.
Re: Internal language parser is not found in xtext project [message #1764318 is a reply to message #1764317] Sun, 28 May 2017 09:34 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
{SomeType} is an unassigned action
{SomeType.left=current} is an assigned action


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Internal language parser is not found in xtext project [message #1764320 is a reply to message #1764318] Sun, 28 May 2017 09:36 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
So you can simply omit the

{thingy} left=somedeeperrule

And use

Somedeeperrule

Only


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Internal language parser is not found in xtext project [message #1764322 is a reply to message #1764320] Sun, 28 May 2017 10:19 Go to previous messageGo to next message
Udeshika Sewwandi is currently offline Udeshika SewwandiFriend
Messages: 118
Registered: March 2017
Senior Member
Hi

I have changed as follws as you said but still the same error is coming.
math_operation:
	//name = name (gt_eq='>='|lt_eq='<='|gt='>'|lt='<') name1 = INT
	fo=function_operation                           
    |{math_operation} constant_value                               
    |{math_operation}attribute_reference 
	| mlo=math_logical_operation
;

math_logical_operation returns math_operation:
	math_in_operation ({math_logical_operation.left=current} (AND | OR) right=math_in_operation)*
;

math_in_operation returns math_operation:
	math_gt_lt_operation ({math_in_operation.left=current} IN right=name)*
;

math_gt_lt_operation returns math_operation:
	math_equal_operation ({math_gt_lt_operation.left=current} (gt_eq='>='|lt_eq='<='|gt='>'|lt='<') right=math_equal_operation)*
;

math_equal_operation returns math_operation:
	math_addsub_operation ({math_gt_lt_operation.left=current} (eq='=='|not_eq='!=') right=math_addsub_operation)*
;

math_addsub_operation returns math_operation:
	math_divmul_operation ({math_addsub_operation.left=current} (add='+'|substract='-') right=math_divmul_operation)*
;

math_divmul_operation returns math_operation:
	math_other_operations ({math_divmul_operation.left=current} (multiply='*'|devide='/'|mod='%') right=math_other_operations)*
;

math_other_operations returns math_operation:
	//'math_op'
	'('math_operation')'                         
    |null_check                                   
    |NOT math_operation 
;


Although the conversion is same as the documentation it doesn't work. I'm stuck there since I cannot proceed. Thank you very much for your help.
Re: Internal language parser is not found in xtext project [message #1764323 is a reply to message #1764322] Sun, 28 May 2017 10:43 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
And what is the error you get?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Internal language parser is not found in xtext project [message #1764326 is a reply to message #1764323] Sun, 28 May 2017 11:20 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
p.s:

working on a simplifieed grammar might help

math_operation:
	//name = name (gt_eq='>='|lt_eq='<='|gt='>'|lt='<') name1 = INT                          
    
	mlo=math_logical_operation
;

math_logical_operation returns math_operation:
	math_in_operation ({math_logical_operation.left=current} ("AND" | "OR") right=math_in_operation)*
;

math_in_operation returns math_operation:
	math_gt_lt_operation ({math_in_operation.left=current} "IN" right=name)*
;

math_gt_lt_operation returns math_operation:
	math_equal_operation ({math_gt_lt_operation.left=current} (gt_eq='>='|lt_eq='<='|gt='>'|lt='<') right=math_equal_operation)*
;

math_equal_operation returns math_operation:
	math_addsub_operation ({math_gt_lt_operation.left=current} (eq='=='|not_eq='!=') right=math_addsub_operation)*
;

math_addsub_operation returns math_operation:
	math_divmul_operation ({math_addsub_operation.left=current} (add='+'|substract='-') right=math_divmul_operation)*
;

math_divmul_operation returns math_operation:
	math_other_operations ({math_divmul_operation.left=current} (multiply='*'|devide='/'|mod='%') right=math_other_operations)*
;

math_other_operations returns math_operation:
	//'math_op'
     =>({NotOperation} NOT op=math_operation) 
	|'('math_operation')'                         
    |null_check
    | literal                                   
;


literal:
	 constant_value                               
    |attribute_reference
;

null_check:
	function_operation ({null_check.expr=current}IS NULL)?
;

function_operation:
	{function_operation}(ns=function_namespace ':')? id=function_id '(' attr=attribute_list?  ')'
; 

function_namespace:
	name	
;

function_id:
	name	
;

attribute_list:
	{attribute_list}( attr += attribute (',' attr += attribute)* )  |{attribute_list} isStar?='*'
;

attribute:
	math_operation
;

name:
	ID
;

constant_value:
	value=STRING
;

attribute_reference:
	value=name
;


NOT: "NOT";
fragment IS : ('is');
fragment NULL: ('null');


(reason for the warnings is inside not)

you can use this pattern for unary expressions:

UnitaryMinus returns Expression:
PrimaryExpression | ({UnitaryMinus} ('-'|"!"|"~") expr=UnitaryMinus);
PrimaryExpression returns Expression:
'(' Expression ')' | ...;

in your case

math_other_operations returns math_operation:
//'math_op'
PrimaryExpression
| =>({NotOperation} NOT op=math_other_operations)

;

PrimaryExpression returns math_operation:
'('math_operation')'
|null_check
| literal
;


and you should have a look at xtext naming conventions.
this makes grammar more readable for other Xtext Users

Rule: attr=SomeRule;

and you should asign stuff from the grammar so that it does not get lost



Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Internal language parser is not found in xtext project [message #1764330 is a reply to message #1764326] Sun, 28 May 2017 11:26 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
you can find more examples e.g here: http://xsemantics.sourceforge.net/xsemantics-documentation/Expressions-example.html

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Internal language parser is not found in xtext project [message #1764353 is a reply to message #1764330] Mon, 29 May 2017 02:59 Go to previous messageGo to next message
Udeshika Sewwandi is currently offline Udeshika SewwandiFriend
Messages: 118
Registered: March 2017
Senior Member
Hi Christian,
I have added some other alternatives which I didn't put earlier and it seems work fine. Thank you very much for your support :) , it was very helpful.

Regards,
Sewwandi
Re: Internal language parser is not found in xtext project [message #1764428 is a reply to message #1764353] Mon, 29 May 2017 15:57 Go to previous messageGo to next message
Udeshika Sewwandi is currently offline Udeshika SewwandiFriend
Messages: 118
Registered: March 2017
Senior Member
Hi,

I have changed query_input rule as follows in order to remove ambiguity. Please correct me if I am wrong.
query_input:
	{query_input}(=>js=join_stream | ps=pattern_stream | seq_s=sequence_stream | anon_s=anonymous_stream)
;

join_stream:
	left_source=join_source right_source=join_source right_unidirectional=UNIDIRECTIONAL (ON expression)? within_time?
	|left_source=join_source join=joins right_source=join_source (ON expression)? within_time?
	|left_source=join_source left_unidirectional=UNIDIRECTIONAL joins right_source=join_source (ON expression)? within_time?
	|standard_stream
;

join_source:
	main_source (AS stream_alias)?
;

main_source:
	source (pre_window_handlers = basic_source_stream_handlers)? (window = win)?
;


The other stream rules are the same as previous. This works fine for the current grammar rules, but I have missed group by and having parts in query_section and insert keyword in query_output. Earlier I had them as follows.
query_section:
	{query_section}(SELECT ('*'| (out_att += output_attribute (',' out_att +=output_attribute)* ))) 
;

query_output:
	(key_word=keyword) (out_event_type = output_event_type)? INTO (tar = target)
;



Now I have changed as follows.
query_section:
	{query_section}(SELECT ('*'| (out_att += output_attribute (',' out_att +=output_attribute)* )) (grp_by=group_by)? (having=having_expr)?) 
;

group_by:
	GROUP BY attr_ref+=attribute_reference (',' attr_ref+=attribute_reference)*
;

having_expr:
	HAVING expr=expression
;

query_output:
	INSERT (out_event_type = output_event_type)? INTO (tar = target)
;


After these changes parser seems not parsing the grammar correctly. Can you give some advises on this? Thank you very much.
Re: Internal language parser is not found in xtext project [message #1764429 is a reply to message #1764428] Mon, 29 May 2017 16:00 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Can you please share a minimal complete reproducing grammar and test model

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Internal language parser is not found in xtext project [message #1764431 is a reply to message #1764428] Mon, 29 May 2017 16:16 Go to previous messageGo to next message
Udeshika Sewwandi is currently offline Udeshika SewwandiFriend
Messages: 118
Registered: March 2017
Senior Member
Hi,

When I put insert into query_output and change only that rule the following error shows in the editor. https://drive.google.com/file/d/0B3tawRCYox59dERaRno0ZjNFZnc/view?usp=sharing

When I change only query_section rule the following error shows in the editor. https://drive.google.com/file/d/0B3tawRCYox59a3pmakJNQkFZMEE/view?usp=sharing.

I have attached the grammar file and test cases.

Thank you.

[Updated on: Mon, 29 May 2017 16:50]

Report message to a moderator

Re: Internal language parser is not found in xtext project [message #1764433 is a reply to message #1764431] Mon, 29 May 2017 16:20 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
I need something I can copy & paste and try myself (incl the grammar )

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Internal language parser is not found in xtext project [message #1764435 is a reply to message #1764433] Mon, 29 May 2017 16:51 Go to previous messageGo to next message
Udeshika Sewwandi is currently offline Udeshika SewwandiFriend
Messages: 118
Registered: March 2017
Senior Member
Hi,

Sorry it took some time to upload the files. I have attached the files in the previous message.
Thank you.
Re: Internal language parser is not found in xtext project [message #1764437 is a reply to message #1764435] Mon, 29 May 2017 17:17 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
well that is not what i meant with minimal grammar.
and i get errors on generation.
(did you enable backtracking etc????)
that will cover bad errors under the carpet




Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Internal language parser is not found in xtext project [message #1764439 is a reply to message #1764437] Mon, 29 May 2017 17:57 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
here is a grammar that i minified.
it should help you to understand and analyze the problem

pattern_stream:
every_pattern_source_chain
;

every_pattern_source_chain:
every_pattern_source_chain_1 ({every_pattern_source_chain.left=current} op= '->' right=every_pattern_source_chain_1)*
;

every_pattern_source_chain_1 returns every_pattern_source_chain:
{every_pattern_source_chain}'('eps=every_pattern_source_chain')' within_time?
|{every_pattern_source_chain} EVERY '('psc=pattern_source_chain ')' within_time?
|{every_pattern_source_chain} psc=pattern_source_chain
|{every_pattern_source_chain} EVERY ps=pattern_source within_time?
;

pattern_source_chain:
pattern_source_chain_1 ({pattern_source_chain.left=current} op='->' right=pattern_source_chain_1)* //pattern_source_chain '->' pattern_source_chain
;

pattern_source_chain_1 returns pattern_source_chain:
{pattern_source_chain}'('psc=pattern_source_chain')' within_time?
| {pattern_source_chain} ps=pattern_source within_time?
;


pattern_source:
name=ID
;

fragment SCRIPT_ATOM:
'abcd'
;

within_time:
WITHIN time_value
;


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Internal language parser is not found in xtext project [message #1764440 is a reply to message #1764439] Mon, 29 May 2017 18:05 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
i wonder why these chains need to be that complicated.

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Internal language parser is not found in xtext project [message #1764441 is a reply to message #1764440] Mon, 29 May 2017 18:15 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
maybe you can ease that to something like

pattern_stream:
every_pattern_source_chain
;

every_pattern_source_chain:
every_pattern_source_chain_1 ({every_pattern_source_chain.left=current} op= '->' right=every_pattern_source_chain_1)*
;

every_pattern_source_chain_1 returns every_pattern_source_chain:
{every_pattern_source_chain} EVERY '('psc=pattern_source_chain ')' within_time?
|
{every_pattern_source_chain} psc=pattern_source_chain
|{every_pattern_source_chain} EVERY ps=pattern_source wt=within_time?
;

pattern_source_chain:
pattern_source_chain_1 ->({pattern_source_chain.left=current} op='->' right=pattern_source_chain_1)* //pattern_source_chain '->' pattern_source_chain
;

pattern_source_chain_1 returns pattern_source_chain:
{pattern_source_chain}'('psc=pattern_source_chain')' wt=within_time?
| {pattern_source_chain} ps=pattern_source wt=within_time?
;


but i am not sure (and dont have really time/money to digg)


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Internal language parser is not found in xtext project [message #1764442 is a reply to message #1764441] Mon, 29 May 2017 18:23 Go to previous messageGo to next message
Udeshika Sewwandi is currently offline Udeshika SewwandiFriend
Messages: 118
Registered: March 2017
Senior Member
Yeah I have enabled backtracking.
parserGenerator = {
				antlrParam = "-Xconversiontimeout"
    			antlrParam = "40000"
				options = {
					ignoreCase = true
					backtrack=true
					memoize = true
					classSplitting=true
                	fieldsPerClass = "300"
                	methodsPerClass= "800"
				}
			}

Re: Internal language parser is not found in xtext project [message #1764443 is a reply to message #1764442] Mon, 29 May 2017 19:28 Go to previous messageGo to next message
Udeshika Sewwandi is currently offline Udeshika SewwandiFriend
Messages: 118
Registered: March 2017
Senior Member
Hi,

Thank you very much for your time and help. This simplification also gives the same result. When adding INSERT instead of (key_word=keyword) in query_output and adding 'group by' and 'having' in query_section the errors begin to show up in the editor as I mentioned above.
I can't guess why it is happening. Sorry I didn't get what you exactly expect as minimal reproducing grammar. I feel there are ambiguities between every_pattern_source_chain and sequence_source_chain rules too.
Re: Internal language parser is not found in xtext project [message #1764445 is a reply to message #1764443] Mon, 29 May 2017 20:55 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
once again. having a minimal grammar for the query part as well would help.

e.g

query_section:
	{query_section}(SELECT ('*'| (out_att += output_attribute (',' out_att +=output_attribute)* )) (grp_by=group_by)? (having=having_expr)?) 
;

output_attribute:
	{output_attribute} attr=attribute INSERT (att_name +=attribute_name) | {output_attribute} attr_ref=attribute_reference
;


group_by:
	GROUP BY attr_ref+=attribute_reference (',' attr_ref+=attribute_reference)*
;

having_expr:
	HAVING expr=expression
;


attribute_index:
	INT_LITERAL| LAST ('-' INT_LITERAL)?
;

expression:
	literal
;

attribute:
	literal
;

attribute_reference:
	{attribute_reference} hash1='#'? name1=name ('['attribute_index1=attribute_index']')? (hash2='#' name2=name ('['attribute_index2=attribute_index']')?)? '.'  attribute_name
    |{attribute_reference} attribute_name
;

literal:
	{function_operation} constant_value                               
    |{function_operation} attr_ref=attribute_reference
;


constant_value:
	string_value
	| time_value
;

time_value:
	year_value
;

year_value:
	INT_LITERAL YEARS
;

string_value:
	STRING_LITERAL
;

INT_LITERAL :
	DIGIT	
;

STRING_LITERAL:
	STRING
;

fragment DIGIT:
	INT
;


name:
	keyword | ID
;

attribute_name:
	name
;


which gives some warnings with an understandable message as well

warning(200): ../org.xtext.example.mydsl1/src-gen/org/xtext/example/mydsl1/parser/antlr/internal/InternalMyDsl.g:719:2: Decision can match input such as "RULE_STRING" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
warning(200): ../org.xtext.example.mydsl1.ide/src-gen/org/xtext/example/mydsl1/ide/contentassist/antlr/internal/InternalMyDsl.g:1363:1: Decision can match input such as "RULE_STRING" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input

=> i can help you only if you help me to understand your problem based on a small example.
+ e.g. a bunch of unit tests


but if you have a look at

output_attribute:
{output_attribute} attr=attribute INSERT (att_name +=attribute_name) | {output_attribute} attr_ref=attribute_reference

you can see that after the INSERT can only come one attribute name but

insert all events into outputStream ;

are 4 things after insert

maybe that should be parsed as

query_output:
INSERT (out_event_type = output_event_type)? INTO (tar = target)
;

but i dont know
.....


so it might be ambigous in conj with

query:
(ann3 += annotation)* FROM (q_inp = query_input ) (query_sec = query_section)? (q_output = query_output)';'
;

..........

what should go into section and what into output.?
;


a grammar like

model:
	s=query_section? (q_output = query_output)';'
;

query_output:
	INSERT (out_event_type = output_event_type)? INTO (tar = target);

output_event_type:
	ALL EVENTS | ALL RAW EVENTS | EXPIRED EVENTS | EXPIRED RAW EVENTS | CURRENT? EVENTS;

query_section:
	{query_section}(SELECT ('*'| (out_att += output_attribute (',' out_att +=output_attribute)* )) 
		
		//(grp_by=group_by)? (having=having_expr)?
	) 
;

source:
	inner='#'? (str_id = stream_id)
;

stream_id:
	name
;

target:
	source
;
 

output_attribute:
	{output_attribute} attr=attribute INSERT (att_name +=attribute_name) | {output_attribute} attr_ref=attribute_reference
;


group_by:
	GROUP BY attr_ref+=attribute_reference (',' attr_ref+=attribute_reference)*
;

having_expr:
	HAVING expr=expression
;


attribute_index:
	INT_LITERAL| LAST ('-' INT_LITERAL)?
;

expression:
	literal
;

attribute:
	literal
;

attribute_reference:
	{attribute_reference} hash1='#'? name1=name ('['attribute_index1=attribute_index']')? (hash2='#' name2=name ('['attribute_index2=attribute_index']')?)? '.'  attribute_name
    |{attribute_reference} attribute_name
;

literal:
	{function_operation} constant_value                               
    |{function_operation} attr_ref=attribute_reference
;


constant_value:
	string_value
	| time_value
;

time_value:
	year_value
;

year_value:
	INT_LITERAL YEARS
;

string_value:
	STRING_LITERAL
;

INT_LITERAL :
	DIGIT	
;

STRING_LITERAL:
	STRING
;

fragment DIGIT:
	INT
;


name:
	keyword | ID
;

attribute_name:
	name
;



looks ok but gives warnings as well

=>

i recommend to work with smaller grammars, avoid backtracking to nail down the issue


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Internal language parser is not found in xtext project [message #1764447 is a reply to message #1764445] Mon, 29 May 2017 21:21 Go to previous messageGo to next message
Udeshika Sewwandi is currently offline Udeshika SewwandiFriend
Messages: 118
Registered: March 2017
Senior Member
Once I set backtrack=false the same error I mentioned at the beginning start to appear. Thank you very much for your informative resources.
Re: Internal language parser is not found in xtext project [message #1764825 is a reply to message #1764447] Fri, 02 June 2017 13:09 Go to previous messageGo to next message
Udeshika Sewwandi is currently offline Udeshika SewwandiFriend
Messages: 118
Registered: March 2017
Senior Member
Hi,

I want to highlight paranthesis and some other symbols and my language. How can I add it tocustom AntlrTokenToAttributeMapper class in my project? I have referred to the token file and added it as follows. But it didn't work.
else if(tokenName.equals("(") || tokenName.equals(")") || tokenName.equals(">=") || tokenName.equals("<=") || tokenName.equals("==") || tokenName.equals("!=") || tokenName.equals("<") || tokenName.equals("=") || tokenName.equals(">") || tokenName.equals("[") || tokenName.equals("]") || tokenName.equals("{") || tokenName.equals("}") || tokenName.equals("%") || tokenName.equals("+") || tokenName.equals("*") || tokenName.equals("-") || tokenName.equals("/") || tokenName.equals("#") || tokenName.equals(":"))
				return SiddhiHighlightingConfiguration.SYMBOL_ID;


Thank you :)
Re: Internal language parser is not found in xtext project [message #1764826 is a reply to message #1764825] Fri, 02 June 2017 13:13 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Yes but that should be solvable the strategy I gave you
(Although it is pain and a lot of work ) and (my time is limited )


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Internal language parser is not found in xtext project [message #1764834 is a reply to message #1764826] Fri, 02 June 2017 14:08 Go to previous messageGo to next message
Udeshika Sewwandi is currently offline Udeshika SewwandiFriend
Messages: 118
Registered: March 2017
Senior Member
Hi,

I want to highlight paranthesis and some other symbols in my language. How can I add it to custom AntlrTokenToAttributeMapper class in my project? I have referred to the token file and added it as follows. But it didn't work.
if(tokenName.equals("(") || tokenName.equals(")") || tokenName.equals(">=") || tokenName.equals("<=") || tokenName.equals("==") || tokenName.equals("!=") || tokenName.equals("<") || tokenName.equals("=") || tokenName.equals(">") || tokenName.equals("[") || tokenName.equals("]") || tokenName.equals("{") || tokenName.equals("}") || tokenName.equals("%") || tokenName.equals("+") || tokenName.equals("*") || tokenName.equals("-") || tokenName.equals("/") || tokenName.equals("#") || tokenName.equals(":"))
				return SiddhiHighlightingConfiguration.SYMBOL_ID;


So once I searched through the internet I found a solution as follows and it also didn't highlight the punctuations.
private static final Pattern PUNCTUATION = Pattern.compile("\\p{Punct}*");

if(PUNCTUATION.matcher(tokenName).matches())
				return SiddhiHighlightingConfiguration.SYMBOL_ID;



Thank you and waiting for your help :) .
Re: Internal language parser is not found in xtext project [message #1764839 is a reply to message #1764834] Fri, 02 June 2017 14:30 Go to previous messageGo to next message
Udeshika Sewwandi is currently offline Udeshika SewwandiFriend
Messages: 118
Registered: March 2017
Senior Member
Hi,
Sorry for troubling, now the second solution works :)
Re: Internal language parser is not found in xtext project [message #1764843 is a reply to message #1764839] Fri, 02 June 2017 15:02 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
ps: you are allowed to open new topics for new issues

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:mismatched input 'JaFirHug' expecting RULE_NAME
Next Topic:dead loop in parser triggered by content assist
Goto Forum:
  


Current Time: Thu Mar 28 20:41:41 GMT 2024

Powered by FUDForum. Page generated in 0.05362 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top