Skip to content

Commit

Permalink
grammar fix
Browse files Browse the repository at this point in the history
  • Loading branch information
krasa committed Jan 14, 2021
1 parent bb29574 commit 707aedf
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 62 deletions.
105 changes: 48 additions & 57 deletions gen/org/plantuml/idea/grammar/PumlLexer.java

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

4 changes: 2 additions & 2 deletions src/org/plantuml/idea/grammar/_PumlLexer.flex
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ BRACKET_1=\[[^\]\r\n]+\] // [foo bar]
BRACKET_2=\([^\)\r\n,]+\) //without ',' -> do not eat multiple items: (ProductOfferingPrice, ProductUsageSpec)

QUOTE_1=\"[^\"\r\n]+\" // "foo bar"
QUOTE_2=\'[^\'\r\n]+\' // 'foo bar'
//QUOTE_2=\'[^\'\r\n]+\' // 'foo bar' - perhaps better without it, it breaks brackets - [x]a'[y]b' (gantt sample)

COMPLEX_WORD=[A-Za-z0-9_][A-Za-z0-9._-]*[A-Za-z0-9]
WORD_CHARACTER=[A-Za-z0-9]
Expand All @@ -54,7 +54,7 @@ WHITE_SPACE=[\ \t\f]
<YYINITIAL, LINE_START_STATE>{BRACKET_1} { yybegin(YYINITIAL); return itemType(); }
<YYINITIAL, LINE_START_STATE>{BRACKET_2} { yybegin(YYINITIAL); return itemType(); }
<YYINITIAL, LINE_START_STATE>{QUOTE_1} { yybegin(YYINITIAL); return itemType(); }
<YYINITIAL, LINE_START_STATE>{QUOTE_2} { yybegin(YYINITIAL); return itemType(); }
//<YYINITIAL, LINE_START_STATE>{QUOTE_2} { yybegin(YYINITIAL); return itemType(); }
<YYINITIAL, LINE_START_STATE>{COMPLEX_WORD} { yybegin(YYINITIAL); return itemType(); }
<YYINITIAL, LINE_START_STATE>{WORD_CHARACTER}+ { yybegin(YYINITIAL); return itemType(); }
<YYINITIAL, LINE_START_STATE>{TAG} { yybegin(YYINITIAL); return PumlTypes.IDENTIFIER; }
Expand Down
6 changes: 5 additions & 1 deletion testData/ParsingTestData.puml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,8 @@ Max -> Bob : something else
@startuml
ProductOfferingPrice -- ProductUsageSpec: ForUsage >
(ProductOfferingPrice, ProductUsageSpec) .. ProductUsageSpecCharacteristic
@enduml
@enduml

@startuml
foo -> bar: [Test prototype]'s start and ends at [Test prototype]'s end
@enduml
51 changes: 49 additions & 2 deletions testData/ParsingTestData.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FILE(0,910)
FILE(0,1002)
PumlItemImpl(@startuml)(0,9)(0,9)
PsiElement(PumlTokenType.IDENTIFIER)('@startuml')(0,9)
PsiWhiteSpace('\n')(9,10)
Expand Down Expand Up @@ -497,4 +497,51 @@ FILE(0,910)
PsiElement(PumlTokenType.IDENTIFIER)('ProductUsageSpecCharacteristic')(872,902)
PsiWhiteSpace('\n')(902,903)
PumlItemImpl(@enduml)(903,910)(903,910)
PsiElement(PumlTokenType.IDENTIFIER)('@enduml')(903,910)
PsiElement(PumlTokenType.IDENTIFIER)('@enduml')(903,910)
PsiWhiteSpace('\n\n')(910,912)
PumlItemImpl(@startuml)(912,921)(912,921)
PsiElement(PumlTokenType.IDENTIFIER)('@startuml')(912,921)
PsiWhiteSpace('\n')(921,922)
PsiWhiteSpace(' ')(922,923)
PumlItemImpl(foo)(923,926)(923,926)
PsiElement(PumlTokenType.IDENTIFIER)('foo')(923,926)
PsiWhiteSpace(' ')(926,927)
PumlItemImpl(->)(927,929)(927,929)
PsiElement(PumlTokenType.OTHER)('->')(927,929)
PsiWhiteSpace(' ')(929,930)
PumlItemImpl(bar)(930,933)(930,933)
PsiElement(PumlTokenType.IDENTIFIER)('bar')(930,933)
PumlItemImpl(:)(933,934)(933,934)
PsiElement(PumlTokenType.OTHER)(':')(933,934)
PsiWhiteSpace(' ')(934,935)
PumlItemImpl([Test prototype])(935,951)(935,951)
PsiElement(PumlTokenType.IDENTIFIER)('[Test prototype]')(935,951)
PumlItemImpl(')(951,952)(951,952)
PsiElement(PumlTokenType.OTHER)(''')(951,952)
PumlItemImpl(s)(952,953)(952,953)
PsiElement(PumlTokenType.IDENTIFIER)('s')(952,953)
PsiWhiteSpace(' ')(953,954)
PumlItemImpl(start)(954,959)(954,959)
PsiElement(PumlTokenType.IDENTIFIER)('start')(954,959)
PsiWhiteSpace(' ')(959,960)
PumlItemImpl(and)(960,963)(960,963)
PsiElement(PumlTokenType.IDENTIFIER)('and')(960,963)
PsiWhiteSpace(' ')(963,964)
PumlItemImpl(ends)(964,968)(964,968)
PsiElement(PumlTokenType.IDENTIFIER)('ends')(964,968)
PsiWhiteSpace(' ')(968,969)
PumlItemImpl(at)(969,971)(969,971)
PsiElement(PumlTokenType.IDENTIFIER)('at')(969,971)
PsiWhiteSpace(' ')(971,972)
PumlItemImpl([Test prototype])(972,988)(972,988)
PsiElement(PumlTokenType.IDENTIFIER)('[Test prototype]')(972,988)
PumlItemImpl(')(988,989)(988,989)
PsiElement(PumlTokenType.OTHER)(''')(988,989)
PumlItemImpl(s)(989,990)(989,990)
PsiElement(PumlTokenType.IDENTIFIER)('s')(989,990)
PsiWhiteSpace(' ')(990,991)
PumlItemImpl(end)(991,994)(991,994)
PsiElement(PumlTokenType.IDENTIFIER)('end')(991,994)
PsiWhiteSpace('\n')(994,995)
PumlItemImpl(@enduml)(995,1002)(995,1002)
PsiElement(PumlTokenType.IDENTIFIER)('@enduml')(995,1002)

0 comments on commit 707aedf

Please sign in to comment.