Scarlet Line home page Scarlet Line - SOFTWARE DESIGN & DEVELOPMENT

[Home]->[Documentation]->[Syntac Universal Parser]->[Other Grammars]->[Extended Backus-Naur form (EBNF)]->[Symbols]->[body_declaration]

Expand All
Collapse All
Contents

ebnf::body_declaration Locate in Contents

Declaration Locate in Contents

body_declaration[parser_type & tree] ::= { std::string _path;/* }*/
    'include' lws filepath[_path]
        {
        std::ifstream _in(_path.c_str(), std::ios_base::binary | std::ios_base::in);
        if (!_in.is_open())
            {
            for (syntac::code_store::string_vector::const_iterator _pathx = tree.include_path.begin(), _pathy = tree.include_path.end();/* _pathx != _pathy; ++ _pathx)*/
                {
                std::string _filepath(* _pathx);
                _filepath.append(_path);
                _in.open(_filepath.c_str(), std::ios_base::binary | std::ios_base::in);
                if (_in.is_open())
                    {
                    _path.assign(_filepath);
                    break;
                    }
                }
            }
        if (_in.is_open())
            {
            if (_M_ParseMode == DependMode)
                {
                std::cout << ' ' << _path;
                }
            if (_M_verbose)
                {
                std::cerr << std::endl << "include: " << _path << " START" << std::endl;
                }
            std::ifstream _inc(_path.c_str(), std::ios_base::binary | std::ios_base::in);
            /* handle the defaults: */
            bool _was_implicit_ws = tree.get_implicit_ws();
             tree.set_implicit_ws(true);
            if (!syntac_file(_inc, tree, true, _path.c_str()))
                {
                std::cerr << get_last_error();
                }
            tree.set_implicit_ws(_was_implicit_ws);
            if (_M_verbose)
                {
                std::cerr << std::endl << "include: " << _path << " COMPLETE" << std::endl;
                }
            }
        else
            {
            std::cerr << $file << ':' << $line << ": error: could not include: " << _path << std::endl;
            flag_error();
            }
        }
    |    'entry[-_]?point' (lws entrypoint[tree])+
    |    'implicit[-_]?whitespace' (lws label[_path])?
        {
        tree.set_implicit_ws(true);
        if (!_path.empty())
            tree.set_implicit_ws_symbol(_path);
        }
    |    'explicit[-_]?whitespace'    { tree.set_implicit_ws(false);/* }*/
    |    'list[-_]?seperator' (lws label[_path])?
        {
        if (!_path.empty())
            tree.set_list_symbol(_path);
        else
            tree.set_list_symbol("list_seperator");
        }
    |    'case[-_]?sensitive'    { tree.set_case_sensitive(true);/* }*/
    |    'case[-_]?insensitive'    { tree.set_case_sensitive(false);/* }*/
    |    'encoding' lws
        (
            '(binary|8-?bit|latin-?1|iso[ -_]?8859-?1)'i    { tree.set_encoding(syntac::encoding_binary);/* } */
        |    '(ascii|text|7-?bit)'i                            { tree.set_encoding(syntac::encoding_ascii);/* }*/
        |    ('(utf-?8|unicode|31-?bit)'i                    { tree.set_encoding(syntac::encoding_utf8);/* })*/
        )
    |    ('type' lws typedefinition[_path] (lws labeldef[tree, _path])*
        {
        if ($4.empty())
            {
            tree.set_default_type(_path);
            }
        })

Composition Locate in Contents

syntac_file body_declaration Alternation Node Concatenation Node Concatenation Node Concatenation Node Concatenation Node Concatenation Node Concatenation Node Concatenation Node Concatenation Node Concatenation Node Concatenation Node lws filepath Concatenation Node Concatenation Node Concatenation Node Alternation Node 'e' 'x' 'p' 'l' 'i' 'c' 'i' 't' Alternation Node 'w' 'h' 'i' 't' 'e' 's' 'p' 'a' 'c' 'e' Concatenation Node Alternation Node 'c' 'a' 's' 'e' Alternation Node 's' 'e' 'n' 's' 'i' 't' 'i' 'v' 'e' 'c' 'a' 's' 'e' Alternation Node 'i' 'n' 's' 'e' 'n' 's' 'i' 't' 'i' 'v' 'e' Concatenation Node lws Alternation Node Concatenation Node lws typedefinition Iteration Node 'i' 'n' 'c' 'l' 'u' 'd' 'e' 'e' 'n' 't' 'r' 'y' Alternation Node 'p' 'o' 'i' 'n' 't' Concatenation Node Iteration Node 'i' 'm' 'p' 'l' 'i' 'c' 'i' 't' Alternation Node 'w' 'h' 'i' 't' 'e' 's' 'p' 'a' 'c' 'e' Concatenation Node @ '[\\-_]' @ 'l' 'i' 's' 't' Alternation Node 's' 'e' 'p' 'e' 'r' 'a' 't' 'o' 'r' Concatenation Node @ '[\\-_]' @ '[\\-_]' @ 'e' 'n' 'c' 'o' 'd' 'i' 'n' 'g' Alternation Node Alternation Node Alternation Node 't' 'y' 'p' 'e' Concatenation Node '[\\-_]' @ lws entrypoint Concatenation Node '[\\-_]' @ lws label '[\\-_]' @ lws label Concatenation Node Concatenation Node Concatenation Node Concatenation Node Concatenation Node Concatenation Node Concatenation Node Concatenation Node Concatenation Node Concatenation Node lws labeldef lws entrypoint '[Bb]' '[Ii]' '[Nn]' '[Aa]' '[Rr]' '[Yy]' '8' Alternation Node '[Bb]' '[Ii]' '[Tt]' '[Ll]' '[Aa]' '[Tt]' '[Ii]' '[Nn]' Alternation Node '1' '[Ii]' '[Ss]' '[Oo]' Alternation Node '8' '8' '5' '9' Alternation Node '1' '[Aa]' '[Ss]' '[Cc]' '[Ii]' '[Ii]' '[Tt]' '[Ee]' '[Xx]' '[Tt]' '7' Alternation Node '[Bb]' '[Ii]' '[Tt]' '[Uu]' '[Tt]' '[Ff]' Alternation Node '8' '[Uu]' '[Nn]' '[Ii]' '[Cc]' '[Oo]' '[Dd]' '[Ee]' '3' '1' Alternation Node '[Bb]' '[Ii]' '[Tt]' '\\-' @ '\\-' @ '[ ! @ '\\-' @ '\\-' @ '\\-' @ '\\-' @

State Machine Locate in Contents

start:1003:$0 final:1004:$0 lws|{735|$3|736} lws|{735|$28|736} lws|{735|$35|736} filepath|{1005|$4|1006} lws|{735|$9|736} lws|{735|$15|736} lws|{735|$22|736} typedefinition|{1014|$36|1015} entrypoint|{1009|$10|1010} label|{818|$16|819} label|{818|$23|819} lws|{735|$39|736} lws|{735|$9|736} labeldef|{1017|$40|1018} entrypoint|{1009|$10|1010} lws|{735|$39|736} lws|{735|$9|736} labeldef|{1017|$40|1018} entrypoint|{1009|$10|1010}