custom language plugin: grammar-kit works, plugin doesn't

 I have the following grammar:

{
parserClass = "com.first.parser.RulesParser"
parserUtilClass="com.first.parser.RulesParserUtil"

extends = "com.intellij.extapi.psi.ASTWrapperPsiElement"

psiClassPrefix = "Rule"
psiImplClassSuffix = "Impl"
psiPackage = "com.first.plugin.psi"
psiImplPackage = "com.first.plugin.psi.impl"

elementTypeHolderClass = "com.first.plugin.psi.RulesTypes"
elementTypeClass = "com.first.plugin.psi.RuleElementType"
tokenTypeClass = "com.first.plugin.psi.RuleTokenType"

tokens = [
INCLUDE_FILE = '*include-file*'
space = 'regexp:\s+'
comment = 'regexp:[#|//].*'
string = "regexp:\"[^\"]*\"|'[^']*'"

]
}

ruleFile ::= spacing sections

sections ::= [ spacing include_section spacing ]

include_section ::= (INCLUDE_FILE space+ string spacing)*

spacing ::= (space | comment)*

I've tested this in grammar-kit preview with the following test

*include-file* "file1.trd"
*include-file* "file2.trd"

In the deployment of the plugin, i get the following error: RuleTokenType.space expected, got '"file1.trd"'

any tips?

 

 

 

0
2 comments

Thanks Greg. I noticed that the flex generator creates two tokens EOL and WHITE_SPACE. i had my own spacing which was overridden by the WHITE_SPACE that preceded it. Are these two tokens expected? i actually removed WHITE_SPACE to get it working.

0

Please sign in to leave a comment.