├── .gitignore ├── settings.gradle.kts ├── example └── toc.png ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .jitpack.yml ├── src ├── main │ ├── java │ │ ├── module-info.java │ │ └── com │ │ │ └── github │ │ │ └── eightm │ │ │ └── lib │ │ │ ├── DoubleLanguageString.java │ │ │ ├── Page.java │ │ │ ├── internal │ │ │ ├── Reader.java │ │ │ └── LibListener.java │ │ │ └── TableOfContent.java │ ├── gen │ │ └── com │ │ │ └── github │ │ │ └── eightm │ │ │ └── parser │ │ │ ├── TOC.tokens │ │ │ ├── TOCTokens.tokens │ │ │ ├── TOCTokens.interp │ │ │ ├── TOC.interp │ │ │ ├── TOCListener.java │ │ │ ├── TOCTokens.java │ │ │ ├── TOCBaseListener.java │ │ │ └── TOC.java │ └── antlr │ │ ├── TOCTokens.g4 │ │ └── TOC.g4 └── test │ └── java │ └── com │ └── github │ └── eightm │ └── lib │ └── SimpleTest.java ├── LICENSE ├── README.MD ├── gradlew.bat └── gradlew /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | build/ 3 | .gradle/ -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | rootProject.name = "bsl-help-toc-parser" 2 | 3 | -------------------------------------------------------------------------------- /example/toc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1c-syntax/bsl-help-toc-parser/HEAD/example/toc.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1c-syntax/bsl-help-toc-parser/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /.jitpack.yml: -------------------------------------------------------------------------------- 1 | before_install: 2 | - source ~/.sdkman/bin/sdkman-init.sh 3 | - sdk install java 17.0.1-tem 4 | - sdk use java 17.0.1-tem -------------------------------------------------------------------------------- /src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | module eightm.bsl.help.toc.parser { 2 | requires org.antlr.antlr4.runtime; 3 | 4 | exports com.github.eightm.lib; 5 | } -------------------------------------------------------------------------------- /src/main/java/com/github/eightm/lib/DoubleLanguageString.java: -------------------------------------------------------------------------------- 1 | package com.github.eightm.lib; 2 | 3 | public record DoubleLanguageString( 4 | String en, 5 | String ru 6 | ) { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/gen/com/github/eightm/parser/TOC.tokens: -------------------------------------------------------------------------------- 1 | EOL=1 2 | WHTITESPACE=2 3 | QUOTE=3 4 | COMMA=4 5 | STRING=5 6 | LBRACE=6 7 | RBRACE=7 8 | NUMBER=8 9 | '"'=3 10 | ','=4 11 | '{'=6 12 | '}'=7 13 | -------------------------------------------------------------------------------- /src/main/gen/com/github/eightm/parser/TOCTokens.tokens: -------------------------------------------------------------------------------- 1 | EOL=1 2 | WHTITESPACE=2 3 | QUOTE=3 4 | COMMA=4 5 | STRING=5 6 | LBRACE=6 7 | RBRACE=7 8 | NUMBER=8 9 | '"'=3 10 | ','=4 11 | '{'=6 12 | '}'=7 13 | -------------------------------------------------------------------------------- /src/main/java/com/github/eightm/lib/Page.java: -------------------------------------------------------------------------------- 1 | package com.github.eightm.lib; 2 | 3 | import java.util.List; 4 | 5 | public record Page( 6 | DoubleLanguageString title, 7 | String htmlPath, 8 | List children 9 | ) { 10 | } 11 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /src/main/antlr/TOCTokens.g4: -------------------------------------------------------------------------------- 1 | lexer grammar TOCTokens; 2 | 3 | EOL: '\r'? '\n' -> channel(HIDDEN); 4 | WHTITESPACE: [ \t]+ -> skip; 5 | QUOTE: '"'; 6 | COMMA: ','; 7 | 8 | STRING: QUOTE (~[\r\n"] | QUOTE QUOTE)* QUOTE; 9 | 10 | LBRACE: '{'; 11 | RBRACE: '}'; 12 | 13 | NUMBER: DIGIT+; 14 | 15 | fragment DIGIT: [0-9]; -------------------------------------------------------------------------------- /src/test/java/com/github/eightm/lib/SimpleTest.java: -------------------------------------------------------------------------------- 1 | package com.github.eightm.lib; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | class SimpleTest { 6 | 7 | @Test 8 | void test() { 9 | System.out.println("It works"); 10 | // Так как файл справки платформы 1С является объектом исключительных прав фирмы 1С, его использование в публичных тестах 11 | // представляется затруднительным. Если у вас есть идеи как это можно сделать не нарушая лиц. соглашение, welcome. 12 | // TableOfContent.readTableOfContent(Path.of(pathToIndexFile)); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/antlr/TOC.g4: -------------------------------------------------------------------------------- 1 | parser grammar TOC; 2 | 3 | options { 4 | tokenVocab = TOCTokens; 5 | } 6 | 7 | tableOfContent: LBRACE chunkCount COMMA chunk (COMMA chunk)* RBRACE EOF; 8 | 9 | chunk: LBRACE chunkId COMMA chunkParentId COMMA childCount (COMMA childId)* COMMA propertiesContainer RBRACE; 10 | propertiesContainer: LBRACE NUMBER COMMA NUMBER COMMA nameContainer COMMA htmlPath RBRACE; 11 | nameContainer: LBRACE NUMBER COMMA NUMBER (COMMA nameObject (COMMA nameObject)?)? RBRACE; 12 | nameObject: LBRACE languageCode COMMA name RBRACE; 13 | 14 | chunkCount: NUMBER; 15 | chunkId: NUMBER; 16 | chunkParentId: NUMBER; 17 | childCount: NUMBER; 18 | childId: NUMBER; 19 | htmlPath: STRING; 20 | languageCode: STRING; 21 | name: STRING; -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2022 Viktor Gukov (zchokobo@gmail.com) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), 4 | to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, 5 | distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 10 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 11 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /src/main/java/com/github/eightm/lib/internal/Reader.java: -------------------------------------------------------------------------------- 1 | package com.github.eightm.lib.internal; 2 | 3 | import com.github.eightm.lib.Page; 4 | import com.github.eightm.parser.TOC; 5 | import com.github.eightm.parser.TOCTokens; 6 | import org.antlr.v4.runtime.CharStreams; 7 | import org.antlr.v4.runtime.CommonTokenStream; 8 | import org.antlr.v4.runtime.tree.ParseTreeWalker; 9 | 10 | import java.io.IOException; 11 | import java.nio.file.Path; 12 | import java.util.Collections; 13 | import java.util.List; 14 | import java.util.Optional; 15 | 16 | public class Reader { 17 | public List readPages(Path pathToIndexFile) { 18 | try { 19 | var lexer = new TOCTokens(CharStreams.fromPath(pathToIndexFile)); 20 | var tokens = new CommonTokenStream(lexer); 21 | var parser = new TOC(tokens); 22 | var tree = parser.tableOfContent(); 23 | var walker = new ParseTreeWalker(); 24 | LibListener listener = new LibListener(); 25 | 26 | walker.walk(listener, tree); 27 | return listener.result; 28 | 29 | } catch (IOException e) { 30 | return Collections.emptyList(); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/github/eightm/lib/TableOfContent.java: -------------------------------------------------------------------------------- 1 | package com.github.eightm.lib; 2 | 3 | import com.github.eightm.lib.internal.Reader; 4 | 5 | import java.nio.file.Files; 6 | import java.nio.file.Path; 7 | import java.util.Collections; 8 | import java.util.List; 9 | import java.util.Objects; 10 | 11 | /** 12 | * Содержание справки синтакс-помощника 1С. 13 | * Содержит в себе рекурсивный список страниц, каждая из которых содержит заголовок страницы и относительный путь к 14 | * соответствующей html странице. 15 | */ 16 | public class TableOfContent { 17 | 18 | private List pages; 19 | 20 | private TableOfContent() { 21 | // noop 22 | } 23 | 24 | /** 25 | * @param pathToIndexFile путь к файлу содержащему содержание справки синтакс-помощника. Не может быть равен null. 26 | * @return построенное содержание справки 27 | * @throws NullPointerException если {@code pathToIndexFile} равен null. 28 | * @throws IllegalArgumentException если файл справки не существует. 29 | */ 30 | public static TableOfContent readTableOfContent(Path pathToIndexFile) { 31 | Objects.requireNonNull(pathToIndexFile); 32 | 33 | if (!Files.exists(pathToIndexFile)) { 34 | throw new IllegalArgumentException(pathToIndexFile + " does not exist"); 35 | } 36 | 37 | return readFile(pathToIndexFile); 38 | } 39 | 40 | private static TableOfContent readFile(Path pathToIndexFile) { 41 | var reader = new Reader(); 42 | var pages = reader.readPages(pathToIndexFile); 43 | var tableOfContent = new TableOfContent(); 44 | tableOfContent.pages = Collections.unmodifiableList(pages); 45 | return tableOfContent; 46 | } 47 | 48 | public List getPages() { 49 | return pages; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /README.MD: -------------------------------------------------------------------------------- 1 | # Парсер файла оглавления синтакс-помощника платформы 1С 2 | 3 | ## Что делает? 4 | Парсит вот это: 5 | ![table of content](./example/toc.png) 6 | 7 | Оглавление представляет собой файл без расширения, лежит в файле `shcntx_root.hbk`, перед парсингом его нужно извлечь. 8 | 9 | ## Формат файла содержания 10 | Оглавление синтакс-помощника 1С, представляет собой текстовый файл определенного формата ("скобкофайл"). 11 | 12 | Каждая страница синтакс-помощника указывается в виде автономного блока (chunk) обрамленного в фигурные скобки. 13 | Файл оглавления содержит в себе количество блоков в файле, затем описание самих блоков, следующих один за другим, без вложенной иерархии. 14 | 15 | Каждый блок состоит из (упрощенно): 16 | 17 | * порядкового номера текущего блока (id). Нумерация сквозная через весь файл, начинается с нуля; 18 | * номера родительского блока; 19 | * количество дочерних блоков; 20 | * в случае если количество дочерних блоков > 0, перечень номеров дочерних блоков; 21 | * подраздел со свойствами блока: 22 | * имя (заголовок страницы). Может отсутствовать, может быть указан на одном языке, может быть указан на двух языках; 23 | * относительный путь к html файлу страницы, который содержит контент страницы. Может быть пустым. 24 | 25 | Данный парсер читает файл оглавления и преобразует его в более удобную для работы структуру, в виде класса 26 | `TableOfContent` содержащего рекурсивный список дочерних страниц (`Page`). 27 | 28 | ## Особенности 29 | Так как файл справки платформы 1С является объектом исключительных прав фирмы 1С, его использование в публичных тестах 30 | представляется затруднительным. Если у вас есть идеи как это можно сделать не нарушая лиц. соглашение, можете написать автору 31 | на почту или сделать PullRequest. 32 | 33 | ## Лицензия 34 | MIT -------------------------------------------------------------------------------- /src/main/java/com/github/eightm/lib/internal/LibListener.java: -------------------------------------------------------------------------------- 1 | package com.github.eightm.lib.internal; 2 | 3 | import com.github.eightm.lib.DoubleLanguageString; 4 | import com.github.eightm.lib.Page; 5 | import com.github.eightm.parser.TOC; 6 | import com.github.eightm.parser.TOCBaseListener; 7 | 8 | import java.util.ArrayList; 9 | import java.util.HashMap; 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | public class LibListener extends TOCBaseListener { 14 | 15 | private final Map idToPages = new HashMap<>(); 16 | 17 | public final List result = new ArrayList<>(); 18 | 19 | @Override 20 | public void enterChunk(TOC.ChunkContext ctx) { 21 | var pageId = ctx.chunkId().getText(); 22 | var parentPageId = ctx.chunkParentId().getText(); 23 | 24 | var propertiesContainer = ctx.propertiesContainer(); 25 | var htmlPath = getHtmlPath(propertiesContainer); 26 | var pageTitle = readPageTitle(propertiesContainer); 27 | var page = new Page(pageTitle, htmlPath, new ArrayList<>()); 28 | 29 | if (parentPageId.equals("0")) { 30 | result.add(page); 31 | } 32 | 33 | var parent = idToPages.get(parentPageId); 34 | if (parent != null) { 35 | parent.children().add(page); 36 | } 37 | 38 | idToPages.put(pageId, page); 39 | } 40 | 41 | private String getHtmlPath(TOC.PropertiesContainerContext propertiesContainer) { 42 | return propertiesContainer.htmlPath().getText().replace("\"", ""); 43 | } 44 | 45 | private DoubleLanguageString readPageTitle(TOC.PropertiesContainerContext propertiesContainer) { 46 | var nameContainer = propertiesContainer.nameContainer(); 47 | var namesContext = nameContainer.nameObject(); 48 | 49 | if (namesContext == null || namesContext.isEmpty()) { 50 | return new DoubleLanguageString("", ""); 51 | } else if (namesContext.size() == 1) { 52 | var engName = namesContext.get(0); 53 | return new DoubleLanguageString(getName(engName), ""); 54 | } else { 55 | var ruName = namesContext.get(0); 56 | var engName = namesContext.get(1); 57 | return new DoubleLanguageString(getName(engName), getName(ruName)); 58 | } 59 | } 60 | 61 | private String getName(TOC.NameObjectContext nameContext) { 62 | return nameContext.name().getText().replace("\"", ""); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/main/gen/com/github/eightm/parser/TOCTokens.interp: -------------------------------------------------------------------------------- 1 | token literal names: 2 | null 3 | null 4 | null 5 | '"' 6 | ',' 7 | null 8 | '{' 9 | '}' 10 | null 11 | 12 | token symbolic names: 13 | null 14 | EOL 15 | WHTITESPACE 16 | QUOTE 17 | COMMA 18 | STRING 19 | LBRACE 20 | RBRACE 21 | NUMBER 22 | 23 | rule names: 24 | EOL 25 | WHTITESPACE 26 | QUOTE 27 | COMMA 28 | STRING 29 | LBRACE 30 | RBRACE 31 | NUMBER 32 | DIGIT 33 | 34 | channel names: 35 | DEFAULT_TOKEN_CHANNEL 36 | HIDDEN 37 | 38 | mode names: 39 | DEFAULT_MODE 40 | 41 | atn: 42 | [3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 10, 62, 8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 3, 2, 5, 2, 23, 10, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 3, 6, 3, 30, 10, 3, 13, 3, 14, 3, 31, 3, 3, 3, 3, 3, 4, 3, 4, 3, 5, 3, 5, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 7, 6, 45, 10, 6, 12, 6, 14, 6, 48, 11, 6, 3, 6, 3, 6, 3, 7, 3, 7, 3, 8, 3, 8, 3, 9, 6, 9, 57, 10, 9, 13, 9, 14, 9, 58, 3, 10, 3, 10, 2, 2, 11, 3, 3, 5, 4, 7, 5, 9, 6, 11, 7, 13, 8, 15, 9, 17, 10, 19, 2, 3, 2, 5, 4, 2, 11, 11, 34, 34, 5, 2, 12, 12, 15, 15, 36, 36, 3, 2, 50, 59, 2, 65, 2, 3, 3, 2, 2, 2, 2, 5, 3, 2, 2, 2, 2, 7, 3, 2, 2, 2, 2, 9, 3, 2, 2, 2, 2, 11, 3, 2, 2, 2, 2, 13, 3, 2, 2, 2, 2, 15, 3, 2, 2, 2, 2, 17, 3, 2, 2, 2, 3, 22, 3, 2, 2, 2, 5, 29, 3, 2, 2, 2, 7, 35, 3, 2, 2, 2, 9, 37, 3, 2, 2, 2, 11, 39, 3, 2, 2, 2, 13, 51, 3, 2, 2, 2, 15, 53, 3, 2, 2, 2, 17, 56, 3, 2, 2, 2, 19, 60, 3, 2, 2, 2, 21, 23, 7, 15, 2, 2, 22, 21, 3, 2, 2, 2, 22, 23, 3, 2, 2, 2, 23, 24, 3, 2, 2, 2, 24, 25, 7, 12, 2, 2, 25, 26, 3, 2, 2, 2, 26, 27, 8, 2, 2, 2, 27, 4, 3, 2, 2, 2, 28, 30, 9, 2, 2, 2, 29, 28, 3, 2, 2, 2, 30, 31, 3, 2, 2, 2, 31, 29, 3, 2, 2, 2, 31, 32, 3, 2, 2, 2, 32, 33, 3, 2, 2, 2, 33, 34, 8, 3, 3, 2, 34, 6, 3, 2, 2, 2, 35, 36, 7, 36, 2, 2, 36, 8, 3, 2, 2, 2, 37, 38, 7, 46, 2, 2, 38, 10, 3, 2, 2, 2, 39, 46, 5, 7, 4, 2, 40, 45, 10, 3, 2, 2, 41, 42, 5, 7, 4, 2, 42, 43, 5, 7, 4, 2, 43, 45, 3, 2, 2, 2, 44, 40, 3, 2, 2, 2, 44, 41, 3, 2, 2, 2, 45, 48, 3, 2, 2, 2, 46, 44, 3, 2, 2, 2, 46, 47, 3, 2, 2, 2, 47, 49, 3, 2, 2, 2, 48, 46, 3, 2, 2, 2, 49, 50, 5, 7, 4, 2, 50, 12, 3, 2, 2, 2, 51, 52, 7, 125, 2, 2, 52, 14, 3, 2, 2, 2, 53, 54, 7, 127, 2, 2, 54, 16, 3, 2, 2, 2, 55, 57, 5, 19, 10, 2, 56, 55, 3, 2, 2, 2, 57, 58, 3, 2, 2, 2, 58, 56, 3, 2, 2, 2, 58, 59, 3, 2, 2, 2, 59, 18, 3, 2, 2, 2, 60, 61, 9, 4, 2, 2, 61, 20, 3, 2, 2, 2, 8, 2, 22, 31, 44, 46, 58, 4, 2, 3, 2, 8, 2, 2] -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /src/main/gen/com/github/eightm/parser/TOC.interp: -------------------------------------------------------------------------------- 1 | token literal names: 2 | null 3 | null 4 | null 5 | '"' 6 | ',' 7 | null 8 | '{' 9 | '}' 10 | null 11 | 12 | token symbolic names: 13 | null 14 | EOL 15 | WHTITESPACE 16 | QUOTE 17 | COMMA 18 | STRING 19 | LBRACE 20 | RBRACE 21 | NUMBER 22 | 23 | rule names: 24 | tableOfContent 25 | chunk 26 | propertiesContainer 27 | nameContainer 28 | nameObject 29 | chunkCount 30 | chunkId 31 | chunkParentId 32 | childCount 33 | childId 34 | htmlPath 35 | languageCode 36 | name 37 | 38 | 39 | atn: 40 | [3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 10, 106, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 7, 2, 35, 10, 2, 12, 2, 14, 2, 38, 11, 2, 3, 2, 3, 2, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7, 3, 51, 10, 3, 12, 3, 14, 3, 54, 11, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 5, 5, 78, 10, 5, 5, 5, 80, 10, 5, 3, 5, 3, 5, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 7, 3, 7, 3, 8, 3, 8, 3, 9, 3, 9, 3, 10, 3, 10, 3, 11, 3, 11, 3, 12, 3, 12, 3, 13, 3, 13, 3, 14, 3, 14, 3, 14, 2, 2, 15, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 2, 2, 2, 96, 2, 28, 3, 2, 2, 2, 4, 42, 3, 2, 2, 2, 6, 59, 3, 2, 2, 2, 8, 69, 3, 2, 2, 2, 10, 83, 3, 2, 2, 2, 12, 89, 3, 2, 2, 2, 14, 91, 3, 2, 2, 2, 16, 93, 3, 2, 2, 2, 18, 95, 3, 2, 2, 2, 20, 97, 3, 2, 2, 2, 22, 99, 3, 2, 2, 2, 24, 101, 3, 2, 2, 2, 26, 103, 3, 2, 2, 2, 28, 29, 7, 8, 2, 2, 29, 30, 5, 12, 7, 2, 30, 31, 7, 6, 2, 2, 31, 36, 5, 4, 3, 2, 32, 33, 7, 6, 2, 2, 33, 35, 5, 4, 3, 2, 34, 32, 3, 2, 2, 2, 35, 38, 3, 2, 2, 2, 36, 34, 3, 2, 2, 2, 36, 37, 3, 2, 2, 2, 37, 39, 3, 2, 2, 2, 38, 36, 3, 2, 2, 2, 39, 40, 7, 9, 2, 2, 40, 41, 7, 2, 2, 3, 41, 3, 3, 2, 2, 2, 42, 43, 7, 8, 2, 2, 43, 44, 5, 14, 8, 2, 44, 45, 7, 6, 2, 2, 45, 46, 5, 16, 9, 2, 46, 47, 7, 6, 2, 2, 47, 52, 5, 18, 10, 2, 48, 49, 7, 6, 2, 2, 49, 51, 5, 20, 11, 2, 50, 48, 3, 2, 2, 2, 51, 54, 3, 2, 2, 2, 52, 50, 3, 2, 2, 2, 52, 53, 3, 2, 2, 2, 53, 55, 3, 2, 2, 2, 54, 52, 3, 2, 2, 2, 55, 56, 7, 6, 2, 2, 56, 57, 5, 6, 4, 2, 57, 58, 7, 9, 2, 2, 58, 5, 3, 2, 2, 2, 59, 60, 7, 8, 2, 2, 60, 61, 7, 10, 2, 2, 61, 62, 7, 6, 2, 2, 62, 63, 7, 10, 2, 2, 63, 64, 7, 6, 2, 2, 64, 65, 5, 8, 5, 2, 65, 66, 7, 6, 2, 2, 66, 67, 5, 22, 12, 2, 67, 68, 7, 9, 2, 2, 68, 7, 3, 2, 2, 2, 69, 70, 7, 8, 2, 2, 70, 71, 7, 10, 2, 2, 71, 72, 7, 6, 2, 2, 72, 79, 7, 10, 2, 2, 73, 74, 7, 6, 2, 2, 74, 77, 5, 10, 6, 2, 75, 76, 7, 6, 2, 2, 76, 78, 5, 10, 6, 2, 77, 75, 3, 2, 2, 2, 77, 78, 3, 2, 2, 2, 78, 80, 3, 2, 2, 2, 79, 73, 3, 2, 2, 2, 79, 80, 3, 2, 2, 2, 80, 81, 3, 2, 2, 2, 81, 82, 7, 9, 2, 2, 82, 9, 3, 2, 2, 2, 83, 84, 7, 8, 2, 2, 84, 85, 5, 24, 13, 2, 85, 86, 7, 6, 2, 2, 86, 87, 5, 26, 14, 2, 87, 88, 7, 9, 2, 2, 88, 11, 3, 2, 2, 2, 89, 90, 7, 10, 2, 2, 90, 13, 3, 2, 2, 2, 91, 92, 7, 10, 2, 2, 92, 15, 3, 2, 2, 2, 93, 94, 7, 10, 2, 2, 94, 17, 3, 2, 2, 2, 95, 96, 7, 10, 2, 2, 96, 19, 3, 2, 2, 2, 97, 98, 7, 10, 2, 2, 98, 21, 3, 2, 2, 2, 99, 100, 7, 7, 2, 2, 100, 23, 3, 2, 2, 2, 101, 102, 7, 7, 2, 2, 102, 25, 3, 2, 2, 2, 103, 104, 7, 7, 2, 2, 104, 27, 3, 2, 2, 2, 6, 36, 52, 77, 79] -------------------------------------------------------------------------------- /src/main/gen/com/github/eightm/parser/TOCListener.java: -------------------------------------------------------------------------------- 1 | // Generated from TOC.g4 by ANTLR 4.9.3 2 | package com.github.eightm.parser; 3 | import org.antlr.v4.runtime.tree.ParseTreeListener; 4 | 5 | /** 6 | * This interface defines a complete listener for a parse tree produced by 7 | * {@link TOC}. 8 | */ 9 | public interface TOCListener extends ParseTreeListener { 10 | /** 11 | * Enter a parse tree produced by {@link TOC#tableOfContent}. 12 | * @param ctx the parse tree 13 | */ 14 | void enterTableOfContent(TOC.TableOfContentContext ctx); 15 | /** 16 | * Exit a parse tree produced by {@link TOC#tableOfContent}. 17 | * @param ctx the parse tree 18 | */ 19 | void exitTableOfContent(TOC.TableOfContentContext ctx); 20 | /** 21 | * Enter a parse tree produced by {@link TOC#chunk}. 22 | * @param ctx the parse tree 23 | */ 24 | void enterChunk(TOC.ChunkContext ctx); 25 | /** 26 | * Exit a parse tree produced by {@link TOC#chunk}. 27 | * @param ctx the parse tree 28 | */ 29 | void exitChunk(TOC.ChunkContext ctx); 30 | /** 31 | * Enter a parse tree produced by {@link TOC#propertiesContainer}. 32 | * @param ctx the parse tree 33 | */ 34 | void enterPropertiesContainer(TOC.PropertiesContainerContext ctx); 35 | /** 36 | * Exit a parse tree produced by {@link TOC#propertiesContainer}. 37 | * @param ctx the parse tree 38 | */ 39 | void exitPropertiesContainer(TOC.PropertiesContainerContext ctx); 40 | /** 41 | * Enter a parse tree produced by {@link TOC#nameContainer}. 42 | * @param ctx the parse tree 43 | */ 44 | void enterNameContainer(TOC.NameContainerContext ctx); 45 | /** 46 | * Exit a parse tree produced by {@link TOC#nameContainer}. 47 | * @param ctx the parse tree 48 | */ 49 | void exitNameContainer(TOC.NameContainerContext ctx); 50 | /** 51 | * Enter a parse tree produced by {@link TOC#nameObject}. 52 | * @param ctx the parse tree 53 | */ 54 | void enterNameObject(TOC.NameObjectContext ctx); 55 | /** 56 | * Exit a parse tree produced by {@link TOC#nameObject}. 57 | * @param ctx the parse tree 58 | */ 59 | void exitNameObject(TOC.NameObjectContext ctx); 60 | /** 61 | * Enter a parse tree produced by {@link TOC#chunkCount}. 62 | * @param ctx the parse tree 63 | */ 64 | void enterChunkCount(TOC.ChunkCountContext ctx); 65 | /** 66 | * Exit a parse tree produced by {@link TOC#chunkCount}. 67 | * @param ctx the parse tree 68 | */ 69 | void exitChunkCount(TOC.ChunkCountContext ctx); 70 | /** 71 | * Enter a parse tree produced by {@link TOC#chunkId}. 72 | * @param ctx the parse tree 73 | */ 74 | void enterChunkId(TOC.ChunkIdContext ctx); 75 | /** 76 | * Exit a parse tree produced by {@link TOC#chunkId}. 77 | * @param ctx the parse tree 78 | */ 79 | void exitChunkId(TOC.ChunkIdContext ctx); 80 | /** 81 | * Enter a parse tree produced by {@link TOC#chunkParentId}. 82 | * @param ctx the parse tree 83 | */ 84 | void enterChunkParentId(TOC.ChunkParentIdContext ctx); 85 | /** 86 | * Exit a parse tree produced by {@link TOC#chunkParentId}. 87 | * @param ctx the parse tree 88 | */ 89 | void exitChunkParentId(TOC.ChunkParentIdContext ctx); 90 | /** 91 | * Enter a parse tree produced by {@link TOC#childCount}. 92 | * @param ctx the parse tree 93 | */ 94 | void enterChildCount(TOC.ChildCountContext ctx); 95 | /** 96 | * Exit a parse tree produced by {@link TOC#childCount}. 97 | * @param ctx the parse tree 98 | */ 99 | void exitChildCount(TOC.ChildCountContext ctx); 100 | /** 101 | * Enter a parse tree produced by {@link TOC#childId}. 102 | * @param ctx the parse tree 103 | */ 104 | void enterChildId(TOC.ChildIdContext ctx); 105 | /** 106 | * Exit a parse tree produced by {@link TOC#childId}. 107 | * @param ctx the parse tree 108 | */ 109 | void exitChildId(TOC.ChildIdContext ctx); 110 | /** 111 | * Enter a parse tree produced by {@link TOC#htmlPath}. 112 | * @param ctx the parse tree 113 | */ 114 | void enterHtmlPath(TOC.HtmlPathContext ctx); 115 | /** 116 | * Exit a parse tree produced by {@link TOC#htmlPath}. 117 | * @param ctx the parse tree 118 | */ 119 | void exitHtmlPath(TOC.HtmlPathContext ctx); 120 | /** 121 | * Enter a parse tree produced by {@link TOC#languageCode}. 122 | * @param ctx the parse tree 123 | */ 124 | void enterLanguageCode(TOC.LanguageCodeContext ctx); 125 | /** 126 | * Exit a parse tree produced by {@link TOC#languageCode}. 127 | * @param ctx the parse tree 128 | */ 129 | void exitLanguageCode(TOC.LanguageCodeContext ctx); 130 | /** 131 | * Enter a parse tree produced by {@link TOC#name}. 132 | * @param ctx the parse tree 133 | */ 134 | void enterName(TOC.NameContext ctx); 135 | /** 136 | * Exit a parse tree produced by {@link TOC#name}. 137 | * @param ctx the parse tree 138 | */ 139 | void exitName(TOC.NameContext ctx); 140 | } -------------------------------------------------------------------------------- /src/main/gen/com/github/eightm/parser/TOCTokens.java: -------------------------------------------------------------------------------- 1 | // Generated from TOCTokens.g4 by ANTLR 4.9.3 2 | package com.github.eightm.parser; 3 | import org.antlr.v4.runtime.Lexer; 4 | import org.antlr.v4.runtime.CharStream; 5 | import org.antlr.v4.runtime.Token; 6 | import org.antlr.v4.runtime.TokenStream; 7 | import org.antlr.v4.runtime.*; 8 | import org.antlr.v4.runtime.atn.*; 9 | import org.antlr.v4.runtime.dfa.DFA; 10 | import org.antlr.v4.runtime.misc.*; 11 | 12 | @SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) 13 | public class TOCTokens extends Lexer { 14 | static { RuntimeMetaData.checkVersion("4.9.3", RuntimeMetaData.VERSION); } 15 | 16 | protected static final DFA[] _decisionToDFA; 17 | protected static final PredictionContextCache _sharedContextCache = 18 | new PredictionContextCache(); 19 | public static final int 20 | EOL=1, WHTITESPACE=2, QUOTE=3, COMMA=4, STRING=5, LBRACE=6, RBRACE=7, 21 | NUMBER=8; 22 | public static String[] channelNames = { 23 | "DEFAULT_TOKEN_CHANNEL", "HIDDEN" 24 | }; 25 | 26 | public static String[] modeNames = { 27 | "DEFAULT_MODE" 28 | }; 29 | 30 | private static String[] makeRuleNames() { 31 | return new String[] { 32 | "EOL", "WHTITESPACE", "QUOTE", "COMMA", "STRING", "LBRACE", "RBRACE", 33 | "NUMBER", "DIGIT" 34 | }; 35 | } 36 | public static final String[] ruleNames = makeRuleNames(); 37 | 38 | private static String[] makeLiteralNames() { 39 | return new String[] { 40 | null, null, null, "'\"'", "','", null, "'{'", "'}'" 41 | }; 42 | } 43 | private static final String[] _LITERAL_NAMES = makeLiteralNames(); 44 | private static String[] makeSymbolicNames() { 45 | return new String[] { 46 | null, "EOL", "WHTITESPACE", "QUOTE", "COMMA", "STRING", "LBRACE", "RBRACE", 47 | "NUMBER" 48 | }; 49 | } 50 | private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); 51 | public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); 52 | 53 | /** 54 | * @deprecated Use {@link #VOCABULARY} instead. 55 | */ 56 | @Deprecated 57 | public static final String[] tokenNames; 58 | static { 59 | tokenNames = new String[_SYMBOLIC_NAMES.length]; 60 | for (int i = 0; i < tokenNames.length; i++) { 61 | tokenNames[i] = VOCABULARY.getLiteralName(i); 62 | if (tokenNames[i] == null) { 63 | tokenNames[i] = VOCABULARY.getSymbolicName(i); 64 | } 65 | 66 | if (tokenNames[i] == null) { 67 | tokenNames[i] = ""; 68 | } 69 | } 70 | } 71 | 72 | @Override 73 | @Deprecated 74 | public String[] getTokenNames() { 75 | return tokenNames; 76 | } 77 | 78 | @Override 79 | 80 | public Vocabulary getVocabulary() { 81 | return VOCABULARY; 82 | } 83 | 84 | 85 | public TOCTokens(CharStream input) { 86 | super(input); 87 | _interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); 88 | } 89 | 90 | @Override 91 | public String getGrammarFileName() { return "TOCTokens.g4"; } 92 | 93 | @Override 94 | public String[] getRuleNames() { return ruleNames; } 95 | 96 | @Override 97 | public String getSerializedATN() { return _serializedATN; } 98 | 99 | @Override 100 | public String[] getChannelNames() { return channelNames; } 101 | 102 | @Override 103 | public String[] getModeNames() { return modeNames; } 104 | 105 | @Override 106 | public ATN getATN() { return _ATN; } 107 | 108 | public static final String _serializedATN = 109 | "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2\n>\b\1\4\2\t\2\4"+ 110 | "\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\3\2\5\2"+ 111 | "\27\n\2\3\2\3\2\3\2\3\2\3\3\6\3\36\n\3\r\3\16\3\37\3\3\3\3\3\4\3\4\3\5"+ 112 | "\3\5\3\6\3\6\3\6\3\6\3\6\7\6-\n\6\f\6\16\6\60\13\6\3\6\3\6\3\7\3\7\3\b"+ 113 | "\3\b\3\t\6\t9\n\t\r\t\16\t:\3\n\3\n\2\2\13\3\3\5\4\7\5\t\6\13\7\r\b\17"+ 114 | "\t\21\n\23\2\3\2\5\4\2\13\13\"\"\5\2\f\f\17\17$$\3\2\62;\2A\2\3\3\2\2"+ 115 | "\2\2\5\3\2\2\2\2\7\3\2\2\2\2\t\3\2\2\2\2\13\3\2\2\2\2\r\3\2\2\2\2\17\3"+ 116 | "\2\2\2\2\21\3\2\2\2\3\26\3\2\2\2\5\35\3\2\2\2\7#\3\2\2\2\t%\3\2\2\2\13"+ 117 | "\'\3\2\2\2\r\63\3\2\2\2\17\65\3\2\2\2\218\3\2\2\2\23<\3\2\2\2\25\27\7"+ 118 | "\17\2\2\26\25\3\2\2\2\26\27\3\2\2\2\27\30\3\2\2\2\30\31\7\f\2\2\31\32"+ 119 | "\3\2\2\2\32\33\b\2\2\2\33\4\3\2\2\2\34\36\t\2\2\2\35\34\3\2\2\2\36\37"+ 120 | "\3\2\2\2\37\35\3\2\2\2\37 \3\2\2\2 !\3\2\2\2!\"\b\3\3\2\"\6\3\2\2\2#$"+ 121 | "\7$\2\2$\b\3\2\2\2%&\7.\2\2&\n\3\2\2\2\'.\5\7\4\2(-\n\3\2\2)*\5\7\4\2"+ 122 | "*+\5\7\4\2+-\3\2\2\2,(\3\2\2\2,)\3\2\2\2-\60\3\2\2\2.,\3\2\2\2./\3\2\2"+ 123 | "\2/\61\3\2\2\2\60.\3\2\2\2\61\62\5\7\4\2\62\f\3\2\2\2\63\64\7}\2\2\64"+ 124 | "\16\3\2\2\2\65\66\7\177\2\2\66\20\3\2\2\2\679\5\23\n\28\67\3\2\2\29:\3"+ 125 | "\2\2\2:8\3\2\2\2:;\3\2\2\2;\22\3\2\2\2<=\t\4\2\2=\24\3\2\2\2\b\2\26\37"+ 126 | ",.:\4\2\3\2\b\2\2"; 127 | public static final ATN _ATN = 128 | new ATNDeserializer().deserialize(_serializedATN.toCharArray()); 129 | static { 130 | _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; 131 | for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { 132 | _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); 133 | } 134 | } 135 | } -------------------------------------------------------------------------------- /src/main/gen/com/github/eightm/parser/TOCBaseListener.java: -------------------------------------------------------------------------------- 1 | // Generated from TOC.g4 by ANTLR 4.9.3 2 | package com.github.eightm.parser; 3 | 4 | import org.antlr.v4.runtime.ParserRuleContext; 5 | import org.antlr.v4.runtime.tree.ErrorNode; 6 | import org.antlr.v4.runtime.tree.TerminalNode; 7 | 8 | /** 9 | * This class provides an empty implementation of {@link TOCListener}, 10 | * which can be extended to create a listener which only needs to handle a subset 11 | * of the available methods. 12 | */ 13 | public class TOCBaseListener implements TOCListener { 14 | /** 15 | * {@inheritDoc} 16 | * 17 | *

The default implementation does nothing.

18 | */ 19 | @Override public void enterTableOfContent(TOC.TableOfContentContext ctx) { } 20 | /** 21 | * {@inheritDoc} 22 | * 23 | *

The default implementation does nothing.

24 | */ 25 | @Override public void exitTableOfContent(TOC.TableOfContentContext ctx) { } 26 | /** 27 | * {@inheritDoc} 28 | * 29 | *

The default implementation does nothing.

30 | */ 31 | @Override public void enterChunk(TOC.ChunkContext ctx) { } 32 | /** 33 | * {@inheritDoc} 34 | * 35 | *

The default implementation does nothing.

36 | */ 37 | @Override public void exitChunk(TOC.ChunkContext ctx) { } 38 | /** 39 | * {@inheritDoc} 40 | * 41 | *

The default implementation does nothing.

42 | */ 43 | @Override public void enterPropertiesContainer(TOC.PropertiesContainerContext ctx) { } 44 | /** 45 | * {@inheritDoc} 46 | * 47 | *

The default implementation does nothing.

48 | */ 49 | @Override public void exitPropertiesContainer(TOC.PropertiesContainerContext ctx) { } 50 | /** 51 | * {@inheritDoc} 52 | * 53 | *

The default implementation does nothing.

54 | */ 55 | @Override public void enterNameContainer(TOC.NameContainerContext ctx) { } 56 | /** 57 | * {@inheritDoc} 58 | * 59 | *

The default implementation does nothing.

60 | */ 61 | @Override public void exitNameContainer(TOC.NameContainerContext ctx) { } 62 | /** 63 | * {@inheritDoc} 64 | * 65 | *

The default implementation does nothing.

66 | */ 67 | @Override public void enterNameObject(TOC.NameObjectContext ctx) { } 68 | /** 69 | * {@inheritDoc} 70 | * 71 | *

The default implementation does nothing.

72 | */ 73 | @Override public void exitNameObject(TOC.NameObjectContext ctx) { } 74 | /** 75 | * {@inheritDoc} 76 | * 77 | *

The default implementation does nothing.

78 | */ 79 | @Override public void enterChunkCount(TOC.ChunkCountContext ctx) { } 80 | /** 81 | * {@inheritDoc} 82 | * 83 | *

The default implementation does nothing.

84 | */ 85 | @Override public void exitChunkCount(TOC.ChunkCountContext ctx) { } 86 | /** 87 | * {@inheritDoc} 88 | * 89 | *

The default implementation does nothing.

90 | */ 91 | @Override public void enterChunkId(TOC.ChunkIdContext ctx) { } 92 | /** 93 | * {@inheritDoc} 94 | * 95 | *

The default implementation does nothing.

96 | */ 97 | @Override public void exitChunkId(TOC.ChunkIdContext ctx) { } 98 | /** 99 | * {@inheritDoc} 100 | * 101 | *

The default implementation does nothing.

102 | */ 103 | @Override public void enterChunkParentId(TOC.ChunkParentIdContext ctx) { } 104 | /** 105 | * {@inheritDoc} 106 | * 107 | *

The default implementation does nothing.

108 | */ 109 | @Override public void exitChunkParentId(TOC.ChunkParentIdContext ctx) { } 110 | /** 111 | * {@inheritDoc} 112 | * 113 | *

The default implementation does nothing.

114 | */ 115 | @Override public void enterChildCount(TOC.ChildCountContext ctx) { } 116 | /** 117 | * {@inheritDoc} 118 | * 119 | *

The default implementation does nothing.

120 | */ 121 | @Override public void exitChildCount(TOC.ChildCountContext ctx) { } 122 | /** 123 | * {@inheritDoc} 124 | * 125 | *

The default implementation does nothing.

126 | */ 127 | @Override public void enterChildId(TOC.ChildIdContext ctx) { } 128 | /** 129 | * {@inheritDoc} 130 | * 131 | *

The default implementation does nothing.

132 | */ 133 | @Override public void exitChildId(TOC.ChildIdContext ctx) { } 134 | /** 135 | * {@inheritDoc} 136 | * 137 | *

The default implementation does nothing.

138 | */ 139 | @Override public void enterHtmlPath(TOC.HtmlPathContext ctx) { } 140 | /** 141 | * {@inheritDoc} 142 | * 143 | *

The default implementation does nothing.

144 | */ 145 | @Override public void exitHtmlPath(TOC.HtmlPathContext ctx) { } 146 | /** 147 | * {@inheritDoc} 148 | * 149 | *

The default implementation does nothing.

150 | */ 151 | @Override public void enterLanguageCode(TOC.LanguageCodeContext ctx) { } 152 | /** 153 | * {@inheritDoc} 154 | * 155 | *

The default implementation does nothing.

156 | */ 157 | @Override public void exitLanguageCode(TOC.LanguageCodeContext ctx) { } 158 | /** 159 | * {@inheritDoc} 160 | * 161 | *

The default implementation does nothing.

162 | */ 163 | @Override public void enterName(TOC.NameContext ctx) { } 164 | /** 165 | * {@inheritDoc} 166 | * 167 | *

The default implementation does nothing.

168 | */ 169 | @Override public void exitName(TOC.NameContext ctx) { } 170 | 171 | /** 172 | * {@inheritDoc} 173 | * 174 | *

The default implementation does nothing.

175 | */ 176 | @Override public void enterEveryRule(ParserRuleContext ctx) { } 177 | /** 178 | * {@inheritDoc} 179 | * 180 | *

The default implementation does nothing.

181 | */ 182 | @Override public void exitEveryRule(ParserRuleContext ctx) { } 183 | /** 184 | * {@inheritDoc} 185 | * 186 | *

The default implementation does nothing.

187 | */ 188 | @Override public void visitTerminal(TerminalNode node) { } 189 | /** 190 | * {@inheritDoc} 191 | * 192 | *

The default implementation does nothing.

193 | */ 194 | @Override public void visitErrorNode(ErrorNode node) { } 195 | } -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | # 21 | # Gradle start up script for POSIX generated by Gradle. 22 | # 23 | # Important for running: 24 | # 25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 26 | # noncompliant, but you have some other compliant shell such as ksh or 27 | # bash, then to run this script, type that shell name before the whole 28 | # command line, like: 29 | # 30 | # ksh Gradle 31 | # 32 | # Busybox and similar reduced shells will NOT work, because this script 33 | # requires all of these POSIX shell features: 34 | # * functions; 35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 37 | # * compound commands having a testable exit status, especially «case»; 38 | # * various built-in commands including «command», «set», and «ulimit». 39 | # 40 | # Important for patching: 41 | # 42 | # (2) This script targets any POSIX shell, so it avoids extensions provided 43 | # by Bash, Ksh, etc; in particular arrays are avoided. 44 | # 45 | # The "traditional" practice of packing multiple parameters into a 46 | # space-separated string is a well documented source of bugs and security 47 | # problems, so this is (mostly) avoided, by progressively accumulating 48 | # options in "$@", and eventually passing that to Java. 49 | # 50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 52 | # see the in-line comments for details. 53 | # 54 | # There are tweaks for specific operating systems such as AIX, CygWin, 55 | # Darwin, MinGW, and NonStop. 56 | # 57 | # (3) This script is generated from the Groovy template 58 | # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 59 | # within the Gradle project. 60 | # 61 | # You can find Gradle at https://github.com/gradle/gradle/. 62 | # 63 | ############################################################################## 64 | 65 | # Attempt to set APP_HOME 66 | 67 | # Resolve links: $0 may be a link 68 | app_path=$0 69 | 70 | # Need this for daisy-chained symlinks. 71 | while 72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 73 | [ -h "$app_path" ] 74 | do 75 | ls=$( ls -ld "$app_path" ) 76 | link=${ls#*' -> '} 77 | case $link in #( 78 | /*) app_path=$link ;; #( 79 | *) app_path=$APP_HOME$link ;; 80 | esac 81 | done 82 | 83 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit 84 | 85 | APP_NAME="Gradle" 86 | APP_BASE_NAME=${0##*/} 87 | 88 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 89 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 90 | 91 | # Use the maximum available, or set MAX_FD != -1 to use that value. 92 | MAX_FD=maximum 93 | 94 | warn () { 95 | echo "$*" 96 | } >&2 97 | 98 | die () { 99 | echo 100 | echo "$*" 101 | echo 102 | exit 1 103 | } >&2 104 | 105 | # OS specific support (must be 'true' or 'false'). 106 | cygwin=false 107 | msys=false 108 | darwin=false 109 | nonstop=false 110 | case "$( uname )" in #( 111 | CYGWIN* ) cygwin=true ;; #( 112 | Darwin* ) darwin=true ;; #( 113 | MSYS* | MINGW* ) msys=true ;; #( 114 | NONSTOP* ) nonstop=true ;; 115 | esac 116 | 117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 118 | 119 | 120 | # Determine the Java command to use to start the JVM. 121 | if [ -n "$JAVA_HOME" ] ; then 122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 123 | # IBM's JDK on AIX uses strange locations for the executables 124 | JAVACMD=$JAVA_HOME/jre/sh/java 125 | else 126 | JAVACMD=$JAVA_HOME/bin/java 127 | fi 128 | if [ ! -x "$JAVACMD" ] ; then 129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 130 | 131 | Please set the JAVA_HOME variable in your environment to match the 132 | location of your Java installation." 133 | fi 134 | else 135 | JAVACMD=java 136 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 137 | 138 | Please set the JAVA_HOME variable in your environment to match the 139 | location of your Java installation." 140 | fi 141 | 142 | # Increase the maximum file descriptors if we can. 143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 144 | case $MAX_FD in #( 145 | max*) 146 | MAX_FD=$( ulimit -H -n ) || 147 | warn "Could not query maximum file descriptor limit" 148 | esac 149 | case $MAX_FD in #( 150 | '' | soft) :;; #( 151 | *) 152 | ulimit -n "$MAX_FD" || 153 | warn "Could not set maximum file descriptor limit to $MAX_FD" 154 | esac 155 | fi 156 | 157 | # Collect all arguments for the java command, stacking in reverse order: 158 | # * args from the command line 159 | # * the main class name 160 | # * -classpath 161 | # * -D...appname settings 162 | # * --module-path (only if needed) 163 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 164 | 165 | # For Cygwin or MSYS, switch paths to Windows format before running java 166 | if "$cygwin" || "$msys" ; then 167 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 168 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 169 | 170 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 171 | 172 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 173 | for arg do 174 | if 175 | case $arg in #( 176 | -*) false ;; # don't mess with options #( 177 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 178 | [ -e "$t" ] ;; #( 179 | *) false ;; 180 | esac 181 | then 182 | arg=$( cygpath --path --ignore --mixed "$arg" ) 183 | fi 184 | # Roll the args list around exactly as many times as the number of 185 | # args, so each arg winds up back in the position where it started, but 186 | # possibly modified. 187 | # 188 | # NB: a `for` loop captures its iteration list before it begins, so 189 | # changing the positional parameters here affects neither the number of 190 | # iterations, nor the values presented in `arg`. 191 | shift # remove old arg 192 | set -- "$@" "$arg" # push replacement arg 193 | done 194 | fi 195 | 196 | # Collect all arguments for the java command; 197 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of 198 | # shell script including quotes and variable substitutions, so put them in 199 | # double quotes to make sure that they get re-expanded; and 200 | # * put everything else in single quotes, so that it's not re-expanded. 201 | 202 | set -- \ 203 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 204 | -classpath "$CLASSPATH" \ 205 | org.gradle.wrapper.GradleWrapperMain \ 206 | "$@" 207 | 208 | # Use "xargs" to parse quoted args. 209 | # 210 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 211 | # 212 | # In Bash we could simply go: 213 | # 214 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 215 | # set -- "${ARGS[@]}" "$@" 216 | # 217 | # but POSIX shell has neither arrays nor command substitution, so instead we 218 | # post-process each arg (as a line of input to sed) to backslash-escape any 219 | # character that might be a shell metacharacter, then use eval to reverse 220 | # that process (while maintaining the separation between arguments), and wrap 221 | # the whole thing up as a single "set" statement. 222 | # 223 | # This will of course break if any of these variables contains a newline or 224 | # an unmatched quote. 225 | # 226 | 227 | eval "set -- $( 228 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 229 | xargs -n1 | 230 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 231 | tr '\n' ' ' 232 | )" '"$@"' 233 | 234 | exec "$JAVACMD" "$@" 235 | -------------------------------------------------------------------------------- /src/main/gen/com/github/eightm/parser/TOC.java: -------------------------------------------------------------------------------- 1 | // Generated from TOC.g4 by ANTLR 4.9.3 2 | package com.github.eightm.parser; 3 | import org.antlr.v4.runtime.atn.*; 4 | import org.antlr.v4.runtime.dfa.DFA; 5 | import org.antlr.v4.runtime.*; 6 | import org.antlr.v4.runtime.misc.*; 7 | import org.antlr.v4.runtime.tree.*; 8 | import java.util.List; 9 | import java.util.Iterator; 10 | import java.util.ArrayList; 11 | 12 | @SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) 13 | public class TOC extends Parser { 14 | static { RuntimeMetaData.checkVersion("4.9.3", RuntimeMetaData.VERSION); } 15 | 16 | protected static final DFA[] _decisionToDFA; 17 | protected static final PredictionContextCache _sharedContextCache = 18 | new PredictionContextCache(); 19 | public static final int 20 | EOL=1, WHTITESPACE=2, QUOTE=3, COMMA=4, STRING=5, LBRACE=6, RBRACE=7, 21 | NUMBER=8; 22 | public static final int 23 | RULE_tableOfContent = 0, RULE_chunk = 1, RULE_propertiesContainer = 2, 24 | RULE_nameContainer = 3, RULE_nameObject = 4, RULE_chunkCount = 5, RULE_chunkId = 6, 25 | RULE_chunkParentId = 7, RULE_childCount = 8, RULE_childId = 9, RULE_htmlPath = 10, 26 | RULE_languageCode = 11, RULE_name = 12; 27 | private static String[] makeRuleNames() { 28 | return new String[] { 29 | "tableOfContent", "chunk", "propertiesContainer", "nameContainer", "nameObject", 30 | "chunkCount", "chunkId", "chunkParentId", "childCount", "childId", "htmlPath", 31 | "languageCode", "name" 32 | }; 33 | } 34 | public static final String[] ruleNames = makeRuleNames(); 35 | 36 | private static String[] makeLiteralNames() { 37 | return new String[] { 38 | null, null, null, "'\"'", "','", null, "'{'", "'}'" 39 | }; 40 | } 41 | private static final String[] _LITERAL_NAMES = makeLiteralNames(); 42 | private static String[] makeSymbolicNames() { 43 | return new String[] { 44 | null, "EOL", "WHTITESPACE", "QUOTE", "COMMA", "STRING", "LBRACE", "RBRACE", 45 | "NUMBER" 46 | }; 47 | } 48 | private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); 49 | public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); 50 | 51 | /** 52 | * @deprecated Use {@link #VOCABULARY} instead. 53 | */ 54 | @Deprecated 55 | public static final String[] tokenNames; 56 | static { 57 | tokenNames = new String[_SYMBOLIC_NAMES.length]; 58 | for (int i = 0; i < tokenNames.length; i++) { 59 | tokenNames[i] = VOCABULARY.getLiteralName(i); 60 | if (tokenNames[i] == null) { 61 | tokenNames[i] = VOCABULARY.getSymbolicName(i); 62 | } 63 | 64 | if (tokenNames[i] == null) { 65 | tokenNames[i] = ""; 66 | } 67 | } 68 | } 69 | 70 | @Override 71 | @Deprecated 72 | public String[] getTokenNames() { 73 | return tokenNames; 74 | } 75 | 76 | @Override 77 | 78 | public Vocabulary getVocabulary() { 79 | return VOCABULARY; 80 | } 81 | 82 | @Override 83 | public String getGrammarFileName() { return "TOC.g4"; } 84 | 85 | @Override 86 | public String[] getRuleNames() { return ruleNames; } 87 | 88 | @Override 89 | public String getSerializedATN() { return _serializedATN; } 90 | 91 | @Override 92 | public ATN getATN() { return _ATN; } 93 | 94 | public TOC(TokenStream input) { 95 | super(input); 96 | _interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); 97 | } 98 | 99 | public static class TableOfContentContext extends ParserRuleContext { 100 | public TerminalNode LBRACE() { return getToken(TOC.LBRACE, 0); } 101 | public ChunkCountContext chunkCount() { 102 | return getRuleContext(ChunkCountContext.class,0); 103 | } 104 | public List COMMA() { return getTokens(TOC.COMMA); } 105 | public TerminalNode COMMA(int i) { 106 | return getToken(TOC.COMMA, i); 107 | } 108 | public List chunk() { 109 | return getRuleContexts(ChunkContext.class); 110 | } 111 | public ChunkContext chunk(int i) { 112 | return getRuleContext(ChunkContext.class,i); 113 | } 114 | public TerminalNode RBRACE() { return getToken(TOC.RBRACE, 0); } 115 | public TerminalNode EOF() { return getToken(TOC.EOF, 0); } 116 | public TableOfContentContext(ParserRuleContext parent, int invokingState) { 117 | super(parent, invokingState); 118 | } 119 | @Override public int getRuleIndex() { return RULE_tableOfContent; } 120 | @Override 121 | public void enterRule(ParseTreeListener listener) { 122 | if ( listener instanceof TOCListener ) ((TOCListener)listener).enterTableOfContent(this); 123 | } 124 | @Override 125 | public void exitRule(ParseTreeListener listener) { 126 | if ( listener instanceof TOCListener ) ((TOCListener)listener).exitTableOfContent(this); 127 | } 128 | } 129 | 130 | public final TableOfContentContext tableOfContent() throws RecognitionException { 131 | TableOfContentContext _localctx = new TableOfContentContext(_ctx, getState()); 132 | enterRule(_localctx, 0, RULE_tableOfContent); 133 | int _la; 134 | try { 135 | enterOuterAlt(_localctx, 1); 136 | { 137 | setState(26); 138 | match(LBRACE); 139 | setState(27); 140 | chunkCount(); 141 | setState(28); 142 | match(COMMA); 143 | setState(29); 144 | chunk(); 145 | setState(34); 146 | _errHandler.sync(this); 147 | _la = _input.LA(1); 148 | while (_la==COMMA) { 149 | { 150 | { 151 | setState(30); 152 | match(COMMA); 153 | setState(31); 154 | chunk(); 155 | } 156 | } 157 | setState(36); 158 | _errHandler.sync(this); 159 | _la = _input.LA(1); 160 | } 161 | setState(37); 162 | match(RBRACE); 163 | setState(38); 164 | match(EOF); 165 | } 166 | } 167 | catch (RecognitionException re) { 168 | _localctx.exception = re; 169 | _errHandler.reportError(this, re); 170 | _errHandler.recover(this, re); 171 | } 172 | finally { 173 | exitRule(); 174 | } 175 | return _localctx; 176 | } 177 | 178 | public static class ChunkContext extends ParserRuleContext { 179 | public TerminalNode LBRACE() { return getToken(TOC.LBRACE, 0); } 180 | public ChunkIdContext chunkId() { 181 | return getRuleContext(ChunkIdContext.class,0); 182 | } 183 | public List COMMA() { return getTokens(TOC.COMMA); } 184 | public TerminalNode COMMA(int i) { 185 | return getToken(TOC.COMMA, i); 186 | } 187 | public ChunkParentIdContext chunkParentId() { 188 | return getRuleContext(ChunkParentIdContext.class,0); 189 | } 190 | public ChildCountContext childCount() { 191 | return getRuleContext(ChildCountContext.class,0); 192 | } 193 | public PropertiesContainerContext propertiesContainer() { 194 | return getRuleContext(PropertiesContainerContext.class,0); 195 | } 196 | public TerminalNode RBRACE() { return getToken(TOC.RBRACE, 0); } 197 | public List childId() { 198 | return getRuleContexts(ChildIdContext.class); 199 | } 200 | public ChildIdContext childId(int i) { 201 | return getRuleContext(ChildIdContext.class,i); 202 | } 203 | public ChunkContext(ParserRuleContext parent, int invokingState) { 204 | super(parent, invokingState); 205 | } 206 | @Override public int getRuleIndex() { return RULE_chunk; } 207 | @Override 208 | public void enterRule(ParseTreeListener listener) { 209 | if ( listener instanceof TOCListener ) ((TOCListener)listener).enterChunk(this); 210 | } 211 | @Override 212 | public void exitRule(ParseTreeListener listener) { 213 | if ( listener instanceof TOCListener ) ((TOCListener)listener).exitChunk(this); 214 | } 215 | } 216 | 217 | public final ChunkContext chunk() throws RecognitionException { 218 | ChunkContext _localctx = new ChunkContext(_ctx, getState()); 219 | enterRule(_localctx, 2, RULE_chunk); 220 | try { 221 | int _alt; 222 | enterOuterAlt(_localctx, 1); 223 | { 224 | setState(40); 225 | match(LBRACE); 226 | setState(41); 227 | chunkId(); 228 | setState(42); 229 | match(COMMA); 230 | setState(43); 231 | chunkParentId(); 232 | setState(44); 233 | match(COMMA); 234 | setState(45); 235 | childCount(); 236 | setState(50); 237 | _errHandler.sync(this); 238 | _alt = getInterpreter().adaptivePredict(_input,1,_ctx); 239 | while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { 240 | if ( _alt==1 ) { 241 | { 242 | { 243 | setState(46); 244 | match(COMMA); 245 | setState(47); 246 | childId(); 247 | } 248 | } 249 | } 250 | setState(52); 251 | _errHandler.sync(this); 252 | _alt = getInterpreter().adaptivePredict(_input,1,_ctx); 253 | } 254 | setState(53); 255 | match(COMMA); 256 | setState(54); 257 | propertiesContainer(); 258 | setState(55); 259 | match(RBRACE); 260 | } 261 | } 262 | catch (RecognitionException re) { 263 | _localctx.exception = re; 264 | _errHandler.reportError(this, re); 265 | _errHandler.recover(this, re); 266 | } 267 | finally { 268 | exitRule(); 269 | } 270 | return _localctx; 271 | } 272 | 273 | public static class PropertiesContainerContext extends ParserRuleContext { 274 | public TerminalNode LBRACE() { return getToken(TOC.LBRACE, 0); } 275 | public List NUMBER() { return getTokens(TOC.NUMBER); } 276 | public TerminalNode NUMBER(int i) { 277 | return getToken(TOC.NUMBER, i); 278 | } 279 | public List COMMA() { return getTokens(TOC.COMMA); } 280 | public TerminalNode COMMA(int i) { 281 | return getToken(TOC.COMMA, i); 282 | } 283 | public NameContainerContext nameContainer() { 284 | return getRuleContext(NameContainerContext.class,0); 285 | } 286 | public HtmlPathContext htmlPath() { 287 | return getRuleContext(HtmlPathContext.class,0); 288 | } 289 | public TerminalNode RBRACE() { return getToken(TOC.RBRACE, 0); } 290 | public PropertiesContainerContext(ParserRuleContext parent, int invokingState) { 291 | super(parent, invokingState); 292 | } 293 | @Override public int getRuleIndex() { return RULE_propertiesContainer; } 294 | @Override 295 | public void enterRule(ParseTreeListener listener) { 296 | if ( listener instanceof TOCListener ) ((TOCListener)listener).enterPropertiesContainer(this); 297 | } 298 | @Override 299 | public void exitRule(ParseTreeListener listener) { 300 | if ( listener instanceof TOCListener ) ((TOCListener)listener).exitPropertiesContainer(this); 301 | } 302 | } 303 | 304 | public final PropertiesContainerContext propertiesContainer() throws RecognitionException { 305 | PropertiesContainerContext _localctx = new PropertiesContainerContext(_ctx, getState()); 306 | enterRule(_localctx, 4, RULE_propertiesContainer); 307 | try { 308 | enterOuterAlt(_localctx, 1); 309 | { 310 | setState(57); 311 | match(LBRACE); 312 | setState(58); 313 | match(NUMBER); 314 | setState(59); 315 | match(COMMA); 316 | setState(60); 317 | match(NUMBER); 318 | setState(61); 319 | match(COMMA); 320 | setState(62); 321 | nameContainer(); 322 | setState(63); 323 | match(COMMA); 324 | setState(64); 325 | htmlPath(); 326 | setState(65); 327 | match(RBRACE); 328 | } 329 | } 330 | catch (RecognitionException re) { 331 | _localctx.exception = re; 332 | _errHandler.reportError(this, re); 333 | _errHandler.recover(this, re); 334 | } 335 | finally { 336 | exitRule(); 337 | } 338 | return _localctx; 339 | } 340 | 341 | public static class NameContainerContext extends ParserRuleContext { 342 | public TerminalNode LBRACE() { return getToken(TOC.LBRACE, 0); } 343 | public List NUMBER() { return getTokens(TOC.NUMBER); } 344 | public TerminalNode NUMBER(int i) { 345 | return getToken(TOC.NUMBER, i); 346 | } 347 | public List COMMA() { return getTokens(TOC.COMMA); } 348 | public TerminalNode COMMA(int i) { 349 | return getToken(TOC.COMMA, i); 350 | } 351 | public TerminalNode RBRACE() { return getToken(TOC.RBRACE, 0); } 352 | public List nameObject() { 353 | return getRuleContexts(NameObjectContext.class); 354 | } 355 | public NameObjectContext nameObject(int i) { 356 | return getRuleContext(NameObjectContext.class,i); 357 | } 358 | public NameContainerContext(ParserRuleContext parent, int invokingState) { 359 | super(parent, invokingState); 360 | } 361 | @Override public int getRuleIndex() { return RULE_nameContainer; } 362 | @Override 363 | public void enterRule(ParseTreeListener listener) { 364 | if ( listener instanceof TOCListener ) ((TOCListener)listener).enterNameContainer(this); 365 | } 366 | @Override 367 | public void exitRule(ParseTreeListener listener) { 368 | if ( listener instanceof TOCListener ) ((TOCListener)listener).exitNameContainer(this); 369 | } 370 | } 371 | 372 | public final NameContainerContext nameContainer() throws RecognitionException { 373 | NameContainerContext _localctx = new NameContainerContext(_ctx, getState()); 374 | enterRule(_localctx, 6, RULE_nameContainer); 375 | int _la; 376 | try { 377 | enterOuterAlt(_localctx, 1); 378 | { 379 | setState(67); 380 | match(LBRACE); 381 | setState(68); 382 | match(NUMBER); 383 | setState(69); 384 | match(COMMA); 385 | setState(70); 386 | match(NUMBER); 387 | setState(77); 388 | _errHandler.sync(this); 389 | _la = _input.LA(1); 390 | if (_la==COMMA) { 391 | { 392 | setState(71); 393 | match(COMMA); 394 | setState(72); 395 | nameObject(); 396 | setState(75); 397 | _errHandler.sync(this); 398 | _la = _input.LA(1); 399 | if (_la==COMMA) { 400 | { 401 | setState(73); 402 | match(COMMA); 403 | setState(74); 404 | nameObject(); 405 | } 406 | } 407 | 408 | } 409 | } 410 | 411 | setState(79); 412 | match(RBRACE); 413 | } 414 | } 415 | catch (RecognitionException re) { 416 | _localctx.exception = re; 417 | _errHandler.reportError(this, re); 418 | _errHandler.recover(this, re); 419 | } 420 | finally { 421 | exitRule(); 422 | } 423 | return _localctx; 424 | } 425 | 426 | public static class NameObjectContext extends ParserRuleContext { 427 | public TerminalNode LBRACE() { return getToken(TOC.LBRACE, 0); } 428 | public LanguageCodeContext languageCode() { 429 | return getRuleContext(LanguageCodeContext.class,0); 430 | } 431 | public TerminalNode COMMA() { return getToken(TOC.COMMA, 0); } 432 | public NameContext name() { 433 | return getRuleContext(NameContext.class,0); 434 | } 435 | public TerminalNode RBRACE() { return getToken(TOC.RBRACE, 0); } 436 | public NameObjectContext(ParserRuleContext parent, int invokingState) { 437 | super(parent, invokingState); 438 | } 439 | @Override public int getRuleIndex() { return RULE_nameObject; } 440 | @Override 441 | public void enterRule(ParseTreeListener listener) { 442 | if ( listener instanceof TOCListener ) ((TOCListener)listener).enterNameObject(this); 443 | } 444 | @Override 445 | public void exitRule(ParseTreeListener listener) { 446 | if ( listener instanceof TOCListener ) ((TOCListener)listener).exitNameObject(this); 447 | } 448 | } 449 | 450 | public final NameObjectContext nameObject() throws RecognitionException { 451 | NameObjectContext _localctx = new NameObjectContext(_ctx, getState()); 452 | enterRule(_localctx, 8, RULE_nameObject); 453 | try { 454 | enterOuterAlt(_localctx, 1); 455 | { 456 | setState(81); 457 | match(LBRACE); 458 | setState(82); 459 | languageCode(); 460 | setState(83); 461 | match(COMMA); 462 | setState(84); 463 | name(); 464 | setState(85); 465 | match(RBRACE); 466 | } 467 | } 468 | catch (RecognitionException re) { 469 | _localctx.exception = re; 470 | _errHandler.reportError(this, re); 471 | _errHandler.recover(this, re); 472 | } 473 | finally { 474 | exitRule(); 475 | } 476 | return _localctx; 477 | } 478 | 479 | public static class ChunkCountContext extends ParserRuleContext { 480 | public TerminalNode NUMBER() { return getToken(TOC.NUMBER, 0); } 481 | public ChunkCountContext(ParserRuleContext parent, int invokingState) { 482 | super(parent, invokingState); 483 | } 484 | @Override public int getRuleIndex() { return RULE_chunkCount; } 485 | @Override 486 | public void enterRule(ParseTreeListener listener) { 487 | if ( listener instanceof TOCListener ) ((TOCListener)listener).enterChunkCount(this); 488 | } 489 | @Override 490 | public void exitRule(ParseTreeListener listener) { 491 | if ( listener instanceof TOCListener ) ((TOCListener)listener).exitChunkCount(this); 492 | } 493 | } 494 | 495 | public final ChunkCountContext chunkCount() throws RecognitionException { 496 | ChunkCountContext _localctx = new ChunkCountContext(_ctx, getState()); 497 | enterRule(_localctx, 10, RULE_chunkCount); 498 | try { 499 | enterOuterAlt(_localctx, 1); 500 | { 501 | setState(87); 502 | match(NUMBER); 503 | } 504 | } 505 | catch (RecognitionException re) { 506 | _localctx.exception = re; 507 | _errHandler.reportError(this, re); 508 | _errHandler.recover(this, re); 509 | } 510 | finally { 511 | exitRule(); 512 | } 513 | return _localctx; 514 | } 515 | 516 | public static class ChunkIdContext extends ParserRuleContext { 517 | public TerminalNode NUMBER() { return getToken(TOC.NUMBER, 0); } 518 | public ChunkIdContext(ParserRuleContext parent, int invokingState) { 519 | super(parent, invokingState); 520 | } 521 | @Override public int getRuleIndex() { return RULE_chunkId; } 522 | @Override 523 | public void enterRule(ParseTreeListener listener) { 524 | if ( listener instanceof TOCListener ) ((TOCListener)listener).enterChunkId(this); 525 | } 526 | @Override 527 | public void exitRule(ParseTreeListener listener) { 528 | if ( listener instanceof TOCListener ) ((TOCListener)listener).exitChunkId(this); 529 | } 530 | } 531 | 532 | public final ChunkIdContext chunkId() throws RecognitionException { 533 | ChunkIdContext _localctx = new ChunkIdContext(_ctx, getState()); 534 | enterRule(_localctx, 12, RULE_chunkId); 535 | try { 536 | enterOuterAlt(_localctx, 1); 537 | { 538 | setState(89); 539 | match(NUMBER); 540 | } 541 | } 542 | catch (RecognitionException re) { 543 | _localctx.exception = re; 544 | _errHandler.reportError(this, re); 545 | _errHandler.recover(this, re); 546 | } 547 | finally { 548 | exitRule(); 549 | } 550 | return _localctx; 551 | } 552 | 553 | public static class ChunkParentIdContext extends ParserRuleContext { 554 | public TerminalNode NUMBER() { return getToken(TOC.NUMBER, 0); } 555 | public ChunkParentIdContext(ParserRuleContext parent, int invokingState) { 556 | super(parent, invokingState); 557 | } 558 | @Override public int getRuleIndex() { return RULE_chunkParentId; } 559 | @Override 560 | public void enterRule(ParseTreeListener listener) { 561 | if ( listener instanceof TOCListener ) ((TOCListener)listener).enterChunkParentId(this); 562 | } 563 | @Override 564 | public void exitRule(ParseTreeListener listener) { 565 | if ( listener instanceof TOCListener ) ((TOCListener)listener).exitChunkParentId(this); 566 | } 567 | } 568 | 569 | public final ChunkParentIdContext chunkParentId() throws RecognitionException { 570 | ChunkParentIdContext _localctx = new ChunkParentIdContext(_ctx, getState()); 571 | enterRule(_localctx, 14, RULE_chunkParentId); 572 | try { 573 | enterOuterAlt(_localctx, 1); 574 | { 575 | setState(91); 576 | match(NUMBER); 577 | } 578 | } 579 | catch (RecognitionException re) { 580 | _localctx.exception = re; 581 | _errHandler.reportError(this, re); 582 | _errHandler.recover(this, re); 583 | } 584 | finally { 585 | exitRule(); 586 | } 587 | return _localctx; 588 | } 589 | 590 | public static class ChildCountContext extends ParserRuleContext { 591 | public TerminalNode NUMBER() { return getToken(TOC.NUMBER, 0); } 592 | public ChildCountContext(ParserRuleContext parent, int invokingState) { 593 | super(parent, invokingState); 594 | } 595 | @Override public int getRuleIndex() { return RULE_childCount; } 596 | @Override 597 | public void enterRule(ParseTreeListener listener) { 598 | if ( listener instanceof TOCListener ) ((TOCListener)listener).enterChildCount(this); 599 | } 600 | @Override 601 | public void exitRule(ParseTreeListener listener) { 602 | if ( listener instanceof TOCListener ) ((TOCListener)listener).exitChildCount(this); 603 | } 604 | } 605 | 606 | public final ChildCountContext childCount() throws RecognitionException { 607 | ChildCountContext _localctx = new ChildCountContext(_ctx, getState()); 608 | enterRule(_localctx, 16, RULE_childCount); 609 | try { 610 | enterOuterAlt(_localctx, 1); 611 | { 612 | setState(93); 613 | match(NUMBER); 614 | } 615 | } 616 | catch (RecognitionException re) { 617 | _localctx.exception = re; 618 | _errHandler.reportError(this, re); 619 | _errHandler.recover(this, re); 620 | } 621 | finally { 622 | exitRule(); 623 | } 624 | return _localctx; 625 | } 626 | 627 | public static class ChildIdContext extends ParserRuleContext { 628 | public TerminalNode NUMBER() { return getToken(TOC.NUMBER, 0); } 629 | public ChildIdContext(ParserRuleContext parent, int invokingState) { 630 | super(parent, invokingState); 631 | } 632 | @Override public int getRuleIndex() { return RULE_childId; } 633 | @Override 634 | public void enterRule(ParseTreeListener listener) { 635 | if ( listener instanceof TOCListener ) ((TOCListener)listener).enterChildId(this); 636 | } 637 | @Override 638 | public void exitRule(ParseTreeListener listener) { 639 | if ( listener instanceof TOCListener ) ((TOCListener)listener).exitChildId(this); 640 | } 641 | } 642 | 643 | public final ChildIdContext childId() throws RecognitionException { 644 | ChildIdContext _localctx = new ChildIdContext(_ctx, getState()); 645 | enterRule(_localctx, 18, RULE_childId); 646 | try { 647 | enterOuterAlt(_localctx, 1); 648 | { 649 | setState(95); 650 | match(NUMBER); 651 | } 652 | } 653 | catch (RecognitionException re) { 654 | _localctx.exception = re; 655 | _errHandler.reportError(this, re); 656 | _errHandler.recover(this, re); 657 | } 658 | finally { 659 | exitRule(); 660 | } 661 | return _localctx; 662 | } 663 | 664 | public static class HtmlPathContext extends ParserRuleContext { 665 | public TerminalNode STRING() { return getToken(TOC.STRING, 0); } 666 | public HtmlPathContext(ParserRuleContext parent, int invokingState) { 667 | super(parent, invokingState); 668 | } 669 | @Override public int getRuleIndex() { return RULE_htmlPath; } 670 | @Override 671 | public void enterRule(ParseTreeListener listener) { 672 | if ( listener instanceof TOCListener ) ((TOCListener)listener).enterHtmlPath(this); 673 | } 674 | @Override 675 | public void exitRule(ParseTreeListener listener) { 676 | if ( listener instanceof TOCListener ) ((TOCListener)listener).exitHtmlPath(this); 677 | } 678 | } 679 | 680 | public final HtmlPathContext htmlPath() throws RecognitionException { 681 | HtmlPathContext _localctx = new HtmlPathContext(_ctx, getState()); 682 | enterRule(_localctx, 20, RULE_htmlPath); 683 | try { 684 | enterOuterAlt(_localctx, 1); 685 | { 686 | setState(97); 687 | match(STRING); 688 | } 689 | } 690 | catch (RecognitionException re) { 691 | _localctx.exception = re; 692 | _errHandler.reportError(this, re); 693 | _errHandler.recover(this, re); 694 | } 695 | finally { 696 | exitRule(); 697 | } 698 | return _localctx; 699 | } 700 | 701 | public static class LanguageCodeContext extends ParserRuleContext { 702 | public TerminalNode STRING() { return getToken(TOC.STRING, 0); } 703 | public LanguageCodeContext(ParserRuleContext parent, int invokingState) { 704 | super(parent, invokingState); 705 | } 706 | @Override public int getRuleIndex() { return RULE_languageCode; } 707 | @Override 708 | public void enterRule(ParseTreeListener listener) { 709 | if ( listener instanceof TOCListener ) ((TOCListener)listener).enterLanguageCode(this); 710 | } 711 | @Override 712 | public void exitRule(ParseTreeListener listener) { 713 | if ( listener instanceof TOCListener ) ((TOCListener)listener).exitLanguageCode(this); 714 | } 715 | } 716 | 717 | public final LanguageCodeContext languageCode() throws RecognitionException { 718 | LanguageCodeContext _localctx = new LanguageCodeContext(_ctx, getState()); 719 | enterRule(_localctx, 22, RULE_languageCode); 720 | try { 721 | enterOuterAlt(_localctx, 1); 722 | { 723 | setState(99); 724 | match(STRING); 725 | } 726 | } 727 | catch (RecognitionException re) { 728 | _localctx.exception = re; 729 | _errHandler.reportError(this, re); 730 | _errHandler.recover(this, re); 731 | } 732 | finally { 733 | exitRule(); 734 | } 735 | return _localctx; 736 | } 737 | 738 | public static class NameContext extends ParserRuleContext { 739 | public TerminalNode STRING() { return getToken(TOC.STRING, 0); } 740 | public NameContext(ParserRuleContext parent, int invokingState) { 741 | super(parent, invokingState); 742 | } 743 | @Override public int getRuleIndex() { return RULE_name; } 744 | @Override 745 | public void enterRule(ParseTreeListener listener) { 746 | if ( listener instanceof TOCListener ) ((TOCListener)listener).enterName(this); 747 | } 748 | @Override 749 | public void exitRule(ParseTreeListener listener) { 750 | if ( listener instanceof TOCListener ) ((TOCListener)listener).exitName(this); 751 | } 752 | } 753 | 754 | public final NameContext name() throws RecognitionException { 755 | NameContext _localctx = new NameContext(_ctx, getState()); 756 | enterRule(_localctx, 24, RULE_name); 757 | try { 758 | enterOuterAlt(_localctx, 1); 759 | { 760 | setState(101); 761 | match(STRING); 762 | } 763 | } 764 | catch (RecognitionException re) { 765 | _localctx.exception = re; 766 | _errHandler.reportError(this, re); 767 | _errHandler.recover(this, re); 768 | } 769 | finally { 770 | exitRule(); 771 | } 772 | return _localctx; 773 | } 774 | 775 | public static final String _serializedATN = 776 | "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\nj\4\2\t\2\4\3\t"+ 777 | "\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t\13\4"+ 778 | "\f\t\f\4\r\t\r\4\16\t\16\3\2\3\2\3\2\3\2\3\2\3\2\7\2#\n\2\f\2\16\2&\13"+ 779 | "\2\3\2\3\2\3\2\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\7\3\63\n\3\f\3\16\3\66"+ 780 | "\13\3\3\3\3\3\3\3\3\3\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\5\3\5"+ 781 | "\3\5\3\5\3\5\3\5\3\5\3\5\5\5N\n\5\5\5P\n\5\3\5\3\5\3\6\3\6\3\6\3\6\3\6"+ 782 | "\3\6\3\7\3\7\3\b\3\b\3\t\3\t\3\n\3\n\3\13\3\13\3\f\3\f\3\r\3\r\3\16\3"+ 783 | "\16\3\16\2\2\17\2\4\6\b\n\f\16\20\22\24\26\30\32\2\2\2`\2\34\3\2\2\2\4"+ 784 | "*\3\2\2\2\6;\3\2\2\2\bE\3\2\2\2\nS\3\2\2\2\fY\3\2\2\2\16[\3\2\2\2\20]"+ 785 | "\3\2\2\2\22_\3\2\2\2\24a\3\2\2\2\26c\3\2\2\2\30e\3\2\2\2\32g\3\2\2\2\34"+ 786 | "\35\7\b\2\2\35\36\5\f\7\2\36\37\7\6\2\2\37$\5\4\3\2 !\7\6\2\2!#\5\4\3"+ 787 | "\2\" \3\2\2\2#&\3\2\2\2$\"\3\2\2\2$%\3\2\2\2%\'\3\2\2\2&$\3\2\2\2\'(\7"+ 788 | "\t\2\2()\7\2\2\3)\3\3\2\2\2*+\7\b\2\2+,\5\16\b\2,-\7\6\2\2-.\5\20\t\2"+ 789 | "./\7\6\2\2/\64\5\22\n\2\60\61\7\6\2\2\61\63\5\24\13\2\62\60\3\2\2\2\63"+ 790 | "\66\3\2\2\2\64\62\3\2\2\2\64\65\3\2\2\2\65\67\3\2\2\2\66\64\3\2\2\2\67"+ 791 | "8\7\6\2\289\5\6\4\29:\7\t\2\2:\5\3\2\2\2;<\7\b\2\2<=\7\n\2\2=>\7\6\2\2"+ 792 | ">?\7\n\2\2?@\7\6\2\2@A\5\b\5\2AB\7\6\2\2BC\5\26\f\2CD\7\t\2\2D\7\3\2\2"+ 793 | "\2EF\7\b\2\2FG\7\n\2\2GH\7\6\2\2HO\7\n\2\2IJ\7\6\2\2JM\5\n\6\2KL\7\6\2"+ 794 | "\2LN\5\n\6\2MK\3\2\2\2MN\3\2\2\2NP\3\2\2\2OI\3\2\2\2OP\3\2\2\2PQ\3\2\2"+ 795 | "\2QR\7\t\2\2R\t\3\2\2\2ST\7\b\2\2TU\5\30\r\2UV\7\6\2\2VW\5\32\16\2WX\7"+ 796 | "\t\2\2X\13\3\2\2\2YZ\7\n\2\2Z\r\3\2\2\2[\\\7\n\2\2\\\17\3\2\2\2]^\7\n"+ 797 | "\2\2^\21\3\2\2\2_`\7\n\2\2`\23\3\2\2\2ab\7\n\2\2b\25\3\2\2\2cd\7\7\2\2"+ 798 | "d\27\3\2\2\2ef\7\7\2\2f\31\3\2\2\2gh\7\7\2\2h\33\3\2\2\2\6$\64MO"; 799 | public static final ATN _ATN = 800 | new ATNDeserializer().deserialize(_serializedATN.toCharArray()); 801 | static { 802 | _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; 803 | for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { 804 | _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); 805 | } 806 | } 807 | } --------------------------------------------------------------------------------