diff --git a/src/main/grammars/RpmSpecParser.bnf b/src/main/grammars/RpmSpecParser.bnf index 6d73628..26740cc 100644 --- a/src/main/grammars/RpmSpecParser.bnf +++ b/src/main/grammars/RpmSpecParser.bnf @@ -85,7 +85,7 @@ filesBody ::= (filesDirective|COMMENT|EOL|<>|macroDefinition|m filesDirective ::= FILES_DIRECTIVE_TOKEN (filesDirective|anything)* {pin=1} changelogSection ::= changelog changelogBody {pin=1} -changelogBody ::= (EOL|changelogItem)* +changelogBody ::= (EOL|changelogItem|fullMacro)* changelogItem ::= (changelogHeader EOL changelogEntry*) changelogHeader ::= CL_HEADER_TOKEN changelogDate changelogAuthor changelogEmail? '-'? changelogVersion? {pin=1} changelogDate ::= IDENTIFIER IDENTIFIER INTEGER_LITERAL INTEGER_LITERAL diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index e92b1af..575dcb0 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -12,6 +12,7 @@ Changes in version 2.1.0:
]]> diff --git a/src/test/kotlin/com/carbonblack/intellij/rpmspec/RpmSpecParsingTest.kt b/src/test/kotlin/com/carbonblack/intellij/rpmspec/RpmSpecParsingTest.kt index 3f6580a..ee1d319 100644 --- a/src/test/kotlin/com/carbonblack/intellij/rpmspec/RpmSpecParsingTest.kt +++ b/src/test/kotlin/com/carbonblack/intellij/rpmspec/RpmSpecParsingTest.kt @@ -8,6 +8,10 @@ class RpmSpecParsingTest : ParsingTestCase("", "spec", RpmSpecParserDefinition() doTest(true) } + fun testAutoSpecTestData() { + doTest(true) + } + override fun getTestDataPath(): String = "src/test/resources/spec" override fun skipSpaces(): Boolean = false diff --git a/src/test/resources/spec/AutoSpecTestData.RpmSpec.txt b/src/test/resources/spec/AutoSpecTestData.RpmSpec.txt new file mode 100644 index 0000000..d795b57 --- /dev/null +++ b/src/test/resources/spec/AutoSpecTestData.RpmSpec.txt @@ -0,0 +1,47 @@ +RPM SPEC File(0,129) + RpmSpecPackageBodyImpl(PACKAGE_BODY)(0,77) + RpmSpecTagImpl(TAG)(0,28) + PsiElement(RpmSpecTokenType.IDENTIFIER)('Name')(0,4) + PsiElement(RpmSpecTokenType.:)(':')(4,5) + PsiWhiteSpace(' ')(5,16) + RpmSpecTagValueImpl(TAG_VALUE)(16,28) + PsiElement(RpmSpecTokenType.CODE)('test-package')(16,28) + PsiElement(RpmSpecTokenType.EOL)('\n')(28,29) + RpmSpecTagImpl(TAG)(29,57) + PsiElement(RpmSpecTokenType.IDENTIFIER)('Version')(29,36) + PsiElement(RpmSpecTokenType.:)(':')(36,37) + PsiWhiteSpace(' ')(37,45) + RpmSpecTagValueImpl(TAG_VALUE)(45,57) + RpmSpecFullMacroImpl(FULL_MACRO)(45,57) + PsiElement(RpmSpecTokenType.%)('%')(45,46) + RpmSpecMacroImpl(MACRO)(46,57) + PsiElement(RpmSpecTokenType.IDENTIFIER)('autorelease')(46,57) + PsiElement(RpmSpecTokenType.EOL)('\n')(57,58) + RpmSpecTagImpl(TAG)(58,75) + PsiElement(RpmSpecTokenType.IDENTIFIER)('Release')(58,65) + PsiElement(RpmSpecTokenType.:)(':')(65,66) + PsiWhiteSpace(' ')(66,74) + RpmSpecTagValueImpl(TAG_VALUE)(74,75) + PsiElement(RpmSpecTokenType.INTEGER_LITERAL)('1')(74,75) + PsiElement(RpmSpecTokenType.EOL)('\n')(75,76) + PsiElement(RpmSpecTokenType.EOL)('\n')(76,77) + RpmSpecOtherSectionsImpl(OTHER_SECTIONS)(77,104) + RpmSpecGenericSectionImpl(GENERIC_SECTION)(77,104) + PsiElement(RpmSpecTokenType.SHELL_SECTION)('%build')(77,83) + PsiElement(RpmSpecTokenType.EOL)('\n')(83,84) + RpmSpecGenericBodyImpl(GENERIC_BODY)(84,104) + PsiElement(RpmSpecTokenType.IDENTIFIER)('echo')(84,88) + PsiWhiteSpace(' ')(88,89) + PsiElement(RpmSpecTokenType.CODE)('"Hello')(89,95) + PsiWhiteSpace(' ')(95,96) + PsiElement(RpmSpecTokenType.CODE)('World"')(96,102) + PsiElement(RpmSpecTokenType.EOL)('\n')(102,103) + PsiElement(RpmSpecTokenType.EOL)('\n')(103,104) + RpmSpecChangelogSectionImpl(CHANGELOG_SECTION)(104,129) + PsiElement(RpmSpecTokenType.changelog)('%changelog')(104,114) + RpmSpecChangelogBodyImpl(CHANGELOG_BODY)(114,129) + PsiElement(RpmSpecTokenType.EOL)('\n')(114,115) + RpmSpecFullMacroImpl(FULL_MACRO)(115,129) + PsiElement(RpmSpecTokenType.%)('%')(115,116) + RpmSpecMacroImpl(MACRO)(116,129) + PsiElement(RpmSpecTokenType.IDENTIFIER)('autochangelog')(116,129) \ No newline at end of file diff --git a/src/test/resources/spec/AutoSpecTestData.spec b/src/test/resources/spec/AutoSpecTestData.spec new file mode 100644 index 0000000..37b02f2 --- /dev/null +++ b/src/test/resources/spec/AutoSpecTestData.spec @@ -0,0 +1,9 @@ +Name: test-package +Version: %autorelease +Release: 1 + +%build +echo "Hello World" + +%changelog +%autochangelog diff --git a/src/test/resources/spec/AutoSpecTestData.txt b/src/test/resources/spec/AutoSpecTestData.txt new file mode 100644 index 0000000..d795b57 --- /dev/null +++ b/src/test/resources/spec/AutoSpecTestData.txt @@ -0,0 +1,47 @@ +RPM SPEC File(0,129) + RpmSpecPackageBodyImpl(PACKAGE_BODY)(0,77) + RpmSpecTagImpl(TAG)(0,28) + PsiElement(RpmSpecTokenType.IDENTIFIER)('Name')(0,4) + PsiElement(RpmSpecTokenType.:)(':')(4,5) + PsiWhiteSpace(' ')(5,16) + RpmSpecTagValueImpl(TAG_VALUE)(16,28) + PsiElement(RpmSpecTokenType.CODE)('test-package')(16,28) + PsiElement(RpmSpecTokenType.EOL)('\n')(28,29) + RpmSpecTagImpl(TAG)(29,57) + PsiElement(RpmSpecTokenType.IDENTIFIER)('Version')(29,36) + PsiElement(RpmSpecTokenType.:)(':')(36,37) + PsiWhiteSpace(' ')(37,45) + RpmSpecTagValueImpl(TAG_VALUE)(45,57) + RpmSpecFullMacroImpl(FULL_MACRO)(45,57) + PsiElement(RpmSpecTokenType.%)('%')(45,46) + RpmSpecMacroImpl(MACRO)(46,57) + PsiElement(RpmSpecTokenType.IDENTIFIER)('autorelease')(46,57) + PsiElement(RpmSpecTokenType.EOL)('\n')(57,58) + RpmSpecTagImpl(TAG)(58,75) + PsiElement(RpmSpecTokenType.IDENTIFIER)('Release')(58,65) + PsiElement(RpmSpecTokenType.:)(':')(65,66) + PsiWhiteSpace(' ')(66,74) + RpmSpecTagValueImpl(TAG_VALUE)(74,75) + PsiElement(RpmSpecTokenType.INTEGER_LITERAL)('1')(74,75) + PsiElement(RpmSpecTokenType.EOL)('\n')(75,76) + PsiElement(RpmSpecTokenType.EOL)('\n')(76,77) + RpmSpecOtherSectionsImpl(OTHER_SECTIONS)(77,104) + RpmSpecGenericSectionImpl(GENERIC_SECTION)(77,104) + PsiElement(RpmSpecTokenType.SHELL_SECTION)('%build')(77,83) + PsiElement(RpmSpecTokenType.EOL)('\n')(83,84) + RpmSpecGenericBodyImpl(GENERIC_BODY)(84,104) + PsiElement(RpmSpecTokenType.IDENTIFIER)('echo')(84,88) + PsiWhiteSpace(' ')(88,89) + PsiElement(RpmSpecTokenType.CODE)('"Hello')(89,95) + PsiWhiteSpace(' ')(95,96) + PsiElement(RpmSpecTokenType.CODE)('World"')(96,102) + PsiElement(RpmSpecTokenType.EOL)('\n')(102,103) + PsiElement(RpmSpecTokenType.EOL)('\n')(103,104) + RpmSpecChangelogSectionImpl(CHANGELOG_SECTION)(104,129) + PsiElement(RpmSpecTokenType.changelog)('%changelog')(104,114) + RpmSpecChangelogBodyImpl(CHANGELOG_BODY)(114,129) + PsiElement(RpmSpecTokenType.EOL)('\n')(114,115) + RpmSpecFullMacroImpl(FULL_MACRO)(115,129) + PsiElement(RpmSpecTokenType.%)('%')(115,116) + RpmSpecMacroImpl(MACRO)(116,129) + PsiElement(RpmSpecTokenType.IDENTIFIER)('autochangelog')(116,129) \ No newline at end of file