Я не могу разобрать экземпляр языка.
Парсер жалуется на первую строку (test_exe).
#
# example
#
set(TARGET_NAME test_exe)
set(${TARGET_NAME}_IDE_FOLDER "path/path")
set(${TARGET_NAME}_DIRS
${PATH}/a/inc
${PATH}/b/inc
)
set(${TARGET_NAME}_SOURCES
example.c
)
set(${TARGET_NAME}_DEPS
${COMMON_DEPS}
)
configureTestExecutable(${TARGET_NAME} OBJ_TEST)
Выше приведен повторяющийся раздел в языковых экземплярах.
Если я заменю последнюю строку на
configureLibrary(${TARGET_NAME} OBJ_TEST)
это работает.
Я пытался
syntax Configure = configure: ConfigureTestExecutable;
syntax Configure = configure: ConfigureTestExecutable+;
syntax Configure = configure: ConfigureTestExecutable*;
все не работают.
Это
syntax Configure = configure: ConfigureLibrary;
syntax Configure = configure: ConfigureLibrary+;
syntax Configure = configure: ConfigureLibrary*;
работает как-то.
start syntax Build = build: Section+ sections;
layout Layout = Comment*;
lexical Comment = @category="Comment" "#" ![\n]* [\n];
syntax Section = section: Target target Options+ options;
syntax Target = target: "set" "(" Id targetMacro Id targetName ")";
syntax Options = options: IdeFolder Dirs Sources Deps Configure;
syntax IdeFolder = ideFolder: "set" "(" "$" "{" Id targetMacro "}" "_IDE_FOLDER" "\"" Id ideFolderPath "\"" ")";
syntax Dirs = dirs: "set" "(" "$" "{" Id targetMacro "}" "_DIRS" DirsPath+ dirPaths ")";
syntax DirsPath = dirPaths: "$" "{" Id pathMacro "}" Id? path;
syntax Sources = sources: "set" "(" "$" "{" Id targetMacro "}" "_SOURCES" SourceList+ sourceList ")";
syntax Configure = configure:
//ConfigureLibrary*
ConfigureTestExecutable;
//syntax ConfigureLibrary = configureLibrary: "configureLibrary" "(" "$" "{" Id targetMacro "}" Id buildTarget ")";
syntax ConfigureTestExecutable = configureTestExecutable: "configureTestExecutable" "(" "$" "{" Id targetMacro "}" Id buildTarget ")";
Я получаю ошибку разбора:
rascal>x = parse(|project://Instrumentation/src/CMakeLists.cmake|);
|std:///ParseTree.rsc|(15449,5,<447,107>,<447,112>): ParseError(|project://Instrumentation/src/CMakeLists.cmake|(32,1,<4,15>,<4,16>))
at parse(|std:///ParseTree.rsc|(15449,5,<447,107>,<447,112>))
at $root$(|prompt:///|(4,56,<1,4>,<1,60>))
at *** somewhere ***(|std:///ParseTree.rsc|(15449,5,<447,107>,<447,112>))
at parse(|std:///ParseTree.rsc|(15449,5,<447,107>,<447,112>))
at $root$(|prompt:///|(4,56,<1,4>,<1,60>))