Skip to content
Snippets Groups Projects
Commit fa2ea2b1 authored by Adam Wardynski's avatar Adam Wardynski
Browse files

Add imports section to parsing wccl files.

parent cd7f2466
No related branches found
No related tags found
No related merge requests found
......@@ -99,6 +99,8 @@ header {
// Wccl whole file syntax
#include <libwccl/wcclfile.h>
#include <libwccl/lexicon/lexiconparser.h>
// Unicode String
#include <unicode/uniset.h>
#include <unicode/unistr.h>
......@@ -302,7 +304,8 @@ parse_wccl_file
wccl_file = boost::make_shared<WcclFile>(tagset);
boost::shared_ptr<TagRuleSequence> rule_seq;
}
: (any_operator_section [*wccl_file] )*
: (imports_section [*wccl_file])?
(any_operator_section [*wccl_file] )*
(
rule_seq = parse_tag_rule_sequence [tagset] { wccl_file->set_tag_rules(rule_seq); }
(any_operator_section [*wccl_file] )*
......@@ -1826,6 +1829,19 @@ match_operator
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
imports_section [WcclFile& wccl_file]
: (import [wccl_file])+
;
import [WcclFile& wccl_file]
: "import" LPAREN file_path : STRING COMMA lexicon_name : STRING RPAREN {
wccl_file.import_lexicon(
LexiconParser::parse_lexicon(
token_ref_to_std_string(lexicon_name),
token_ref_to_std_string(file_path)));
}
;
any_operator_section
[WcclFile& wccl_file]
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment