OPTION(ANTCC_BUILD_TESTS "Build antcc tests" OFF)
OPTION(ANTCC_BUILD_DOCS "Build antcc docs" OFF)
+OPTION(ANTCC_USE_LEMON "Use Lemon/ragel instead of flex bison" ON)
+
+find_program(RAGEL NAMES ragel ragel.exe PATHS c:/msys64/mingw64/bin ENV)
+
# new way
CONFIGURE_FILE(${antcc_SOURCE_DIR}/src/antcc/config.h.cmake
${antcc_BINARY_DIR}/src/antcc/config.h)
MESSAGE(STATUS " Features")
MESSAGE(STATUS " Use boost ............ ${ANTCC_WITH_BOOST}")
MESSAGE(STATUS " Use aeb .............. ${ANTCC_WITH_AEB}")
+MESSAGE(STATUS "")
+MESSAGE(STATUS " Programs")
+MESSAGE(STATUS " Use ragel ............ ${RAGEL}")
MESSAGE(STATUS "==============================================================")
-Subproject commit aeca878a84169490996e427211493ac306f00c7c
+Subproject commit bd52bb81d0b9b6d93a31d3d78801798e13d05a8a
INCLUDE_DIRECTORIES(${aebutils_SOURCE_DIR})
# For option...
INCLUDE_DIRECTORIES(${aebutils_SOURCE_DIR}/aeb)
-
-FLEXGEN(SOURCE reference.l OUTPUT ref_l.cpp OPTS -R )
-BISONGEN(reference.y ref_y.cpp cpp)
+
+set(PLIB_GEN_SRCS "")
+
+if(ANTCC_USE_LEMON)
+ RAGELGEN(SOURCE reference_lexer.ragel OUTPUT ref_l.cpp)
+ LEMONGEN(SOURCE reference.lemon OUTPUT reference.c)
+ list(APPEND PLIB_GEN_SRCS ${CMAKE_CURRENT_BINARY_DIR}/reference.c)
+ list(APPEND PLIB_GEN_SRCS ${CMAKE_CURRENT_BINARY_DIR}/ref_l.cpp)
+else()
+ FLEXGEN(SOURCE reference.l OUTPUT ref_l.cpp OPTS -R )
+ BISONGEN(reference.y ref_y.cpp cpp)
+ list(APPEND PLIB_GEN_SRCS ${CMAKE_CURRENT_BINARY_DIR}/ref_y.cpp)
+ list(APPEND PLIB_GEN_SRCS ${CMAKE_CURRENT_BINARY_DIR}/ref_l.cpp)
+endif()
+
+
+
+
+
ADD_LIBRARY(propertylib
reference_parser.cpp
property_file.cpp
- ${CMAKE_CURRENT_BINARY_DIR}/ref_l.cpp
- ${CMAKE_CURRENT_BINARY_DIR}/ref_y.cpp
+ ${PLIB_GEN_SRCS}
)
ADD_EXECUTABLE(test_prop_parser
reference_parser.cpp
- ${CMAKE_CURRENT_BINARY_DIR}/ref_y.cpp
- ${CMAKE_CURRENT_BINARY_DIR}/ref_l.cpp
+ ${PLIB_GEN_SRCS}
)
TARGET_LINK_LIBRARIES(test_prop_parser libantcc_parser libantcc_cond libantcc ${EXPAT_LIBRARY})
--- /dev/null
+/*
+ *
+ */
+
+%include{
+
+#include <memory>
+#include <numeric>
+#include <algorithm>
+#include <utility>
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <cstdlib>
+
+#include <vector>
+#include <list>
+#include <map>
+#include <stack>
+
+#include <antcc/config.h>
+#include <os/path.h>
+#include <os/file.h>
+#include <logger.h>
+#include <location.h>
+#include <xml/parser/ant_elements.h>
+#include <xml/parser/ant_element_factory.h>
+#include <project.h>
+#include <projectComponent.h>
+#include <reference_parser.h>
+
+#include <tasks/condition/ICondition.h>
+#include <tasks/condition/not.h>
+#include <tasks/condition/or.h>
+#include <tasks/condition/and.h>
+#include <tasks/condition/isSet.h>
+
+
+#include <reference_parser_base.h>
+}
+
+%stack_size 0
+
+%syntax_error {
+ printf("Syntax Error! Suggested tokens:\n");
+ const YYACTIONTYPE stateno = yytos->stateno;
+ for (unsigned i = 0; i < YYNTOKEN; ++i) {
+ int yyact = yy_find_shift_action(i, stateno);
+ if (yyact != YY_ERROR_ACTION && yyact != YY_NO_ACTION) {
+ printf(" %s\n", yyTokenName[i]);
+ }
+ }
+}
+
+%code {
+#if 0
+std::unique_ptr<reference_parser> reference_parser::create() {
+ return std::make_unique<yypParser>();
+ }
+
+#endif
+}
+
+
+%token_type {Token &&}
+%type function { antcc::condition::ICondition }
+%type phrase { antcc:condition::ICondition::Result *}
+
+
+value ::= . /* empty */
+
+value ::= phrase(F). {
+ p->setResult(*F);
+ delete F;
+ }
+
+value ::= function(F). {
+ antcc::condition::ICondition::Result _result;
+ if ( F&& F->eval(_result) )
+ {
+ std::cout<<"TODO function yes:"<<_result.m_Str<<std::endl;
+ } else {
+ std::cout<<"TODO function no:"<<_result.m_Str<<std::endl;
+
+ }
+ p->setResult("");
+ }
+
+
--- /dev/null
+
+
+%%{
+
+ machine reference_lexer;
+
+}%%
+
+#include <string>
+#include <cstring>
+#include <stdlib.h>
+#include <numeric>
--- /dev/null
+#ifndef __REFERERENCE_PAESER_BASE_H__
+#define __REFERERENCE_PAESER_BASE_H__
+
+#include <cstdio>
+#include <memory>
+#include <string>
+
+struct Token {
+
+ Token() = default;
+ Token(const Token &) = default;
+ Token(Token &&) = default;
+
+ Token(int i) : intValue(i)
+ {}
+ Token(const std::string &s) : stringValue(s)
+ {}
+ Token(std::string &&s) : stringValue(std::move(s))
+ {}
+
+
+ Token& operator=(const Token &) = default;
+ Token& operator=(Token &&) = default;
+
+ int intValue = 0;
+ std::string stringValue;
+};
+
+#endif
PROJECT(antxml)
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 3.5)
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}")
SUBDIRS(parser reqif)
-Subproject commit 5f6e9134ab67b61537fc0bf557842221001f76b1
+Subproject commit 00ae10fbac5ef65798350fdbc1301c831abf28df