LCOV - code coverage report
Current view: top level - include/as2js - parser.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 1 100.0 %
Date: 2014-11-22 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : #ifndef AS2JS_PARSER_H
       2             : #define AS2JS_PARSER_H
       3             : /* as2js/parser.h -- written by Alexis WILKE for Made to Order Software Corp. (c) 2005-2014 */
       4             : 
       5             : /*
       6             : 
       7             : Copyright (c) 2005-2014 Made to Order Software Corp.
       8             : 
       9             : http://snapwebsites.org/project/as2js
      10             : 
      11             : Permission is hereby granted, free of charge, to any
      12             : person obtaining a copy of this software and
      13             : associated documentation files (the "Software"), to
      14             : deal in the Software without restriction, including
      15             : without limitation the rights to use, copy, modify,
      16             : merge, publish, distribute, sublicense, and/or sell
      17             : copies of the Software, and to permit persons to whom
      18             : the Software is furnished to do so, subject to the
      19             : following conditions:
      20             : 
      21             : The above copyright notice and this permission notice
      22             : shall be included in all copies or substantial
      23             : portions of the Software.
      24             : 
      25             : THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
      26             : ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
      27             : LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
      28             : FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
      29             : EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
      30             : LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
      31             : WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
      32             : ARISING FROM, OUT OF OR IN CONNECTION WITH THE
      33             : SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
      34             : SOFTWARE.
      35             : 
      36             : */
      37             : 
      38             : 
      39             : #include    "as2js/lexer.h"
      40             : 
      41             : namespace as2js
      42             : {
      43             : 
      44             : 
      45             : // OLD DOCUMENTATION
      46             : // We do not have a separate interface for now...
      47             : //
      48             : // The parser class is mostly hidden to you.
      49             : // You can't derive from it. You call the CreateParser() to use it.
      50             : // Once you are finished with the parser, delete it.
      51             : // Note that deleting the parser doesn't delete the nodes and thus
      52             : // you can work with the tree even after you deleted the parser.
      53             : //
      54             : // You use like this:
      55             : //
      56             : //    using namespace sswf::as;
      57             : //    MyInput input;
      58             : //    Parser *parser = Parser::CreateParser();
      59             : //    parser->SetInput(input);
      60             : //    // it is optional to set the options
      61             : //    parser->SetOptions(options);
      62             : //    NodePtr root = parser->Parse();
      63             : //
      64             : // NOTE: the input and options are NOT copied, a pointer to these
      65             : // object is saved in the parser. Delete the Parser() before you
      66             : // delete them. Also, this means you can change the options as the
      67             : // parsing goes on (i.e. usually this happens in Input::Error().).
      68     1254956 : class Parser
      69             : {
      70             : public:
      71             :     typedef std::shared_ptr<Parser>     pointer_t;
      72             : 
      73             :                         Parser(Input::pointer_t input, Options::pointer_t options);
      74             : 
      75             :     Node::pointer_t     parse();
      76             : 
      77             : private:
      78             :     void                get_token();
      79             :     void                unget_token(Node::pointer_t& data);
      80             :     bool                has_option_set(Options::option_t option) const;
      81             : 
      82             :     void                additive_expression(Node::pointer_t& node);
      83             :     void                assignment_expression(Node::pointer_t& node);
      84             :     void                attributes(Node::pointer_t& attr_list);
      85             :     void                bitwise_and_expression(Node::pointer_t& node);
      86             :     void                bitwise_or_expression(Node::pointer_t& node);
      87             :     void                bitwise_xor_expression(Node::pointer_t& node);
      88             :     void                block(Node::pointer_t& node);
      89             :     void                break_continue(Node::pointer_t& node, Node::node_t type);
      90             :     void                case_directive(Node::pointer_t& node);
      91             :     void                catch_directive(Node::pointer_t& node);
      92             :     void                class_declaration(Node::pointer_t& node, Node::node_t type);
      93             :     void                conditional_expression(Node::pointer_t& node, bool assignment);
      94             :     void                contract_declaration(Node::pointer_t& node, Node::node_t type);
      95             :     void                debugger(Node::pointer_t& node);
      96             :     void                default_directive(Node::pointer_t& node);
      97             :     void                directive(Node::pointer_t& node);
      98             :     void                directive_list(Node::pointer_t& node);
      99             :     void                do_directive(Node::pointer_t& node);
     100             :     void                enum_declaration(Node::pointer_t& node);
     101             :     void                equality_expression(Node::pointer_t& node);
     102             :     void                expression(Node::pointer_t& node);
     103             :     void                function(Node::pointer_t& node, bool const expression);
     104             :     void                for_directive(Node::pointer_t& node);
     105             :     void                forced_block(Node::pointer_t& node, Node::pointer_t statement);
     106             :     void                goto_directive(Node::pointer_t& node);
     107             :     void                if_directive(Node::pointer_t& node);
     108             :     void                import(Node::pointer_t& node);
     109             :     void                list_expression(Node::pointer_t& node, bool rest, bool empty);
     110             :     void                logical_and_expression(Node::pointer_t& node);
     111             :     void                logical_or_expression(Node::pointer_t& node);
     112             :     void                logical_xor_expression(Node::pointer_t& node);
     113             :     void                match_expression(Node::pointer_t& node);
     114             :     void                min_max_expression(Node::pointer_t& node);
     115             :     void                multiplicative_expression(Node::pointer_t& node);
     116             :     void                namespace_block(Node::pointer_t& node, Node::pointer_t& attr_list);
     117             :     void                numeric_type(Node::pointer_t& numeric_type_node, Node::pointer_t& name);
     118             :     void                object_literal_expression(Node::pointer_t& node);
     119             :     void                parameter_list(Node::pointer_t& node, bool& has_out);
     120             :     void                pragma();
     121             :     void                pragma_option(Options::option_t option, bool prima, Node::pointer_t& argument, Options::option_value_t value);
     122             :     void                program(Node::pointer_t& node);
     123             :     void                package(Node::pointer_t& node);
     124             :     void                postfix_expression(Node::pointer_t& node);
     125             :     void                power_expression(Node::pointer_t& node);
     126             :     void                primary_expression(Node::pointer_t& node);
     127             :     void                relational_expression(Node::pointer_t& node);
     128             :     void                return_directive(Node::pointer_t& node);
     129             :     void                shift_expression(Node::pointer_t& node);
     130             :     void                switch_directive(Node::pointer_t& node);
     131             :     void                synchronized(Node::pointer_t& node);
     132             :     void                throw_directive(Node::pointer_t& node);
     133             :     void                try_finally(Node::pointer_t& node, Node::node_t type);
     134             :     void                unary_expression(Node::pointer_t& node);
     135             :     void                use_namespace(Node::pointer_t& node);
     136             :     void                variable(Node::pointer_t& node, bool const constant);
     137             :     void                with_while(Node::pointer_t& node, Node::node_t type);
     138             :     void                yield(Node::pointer_t& node);
     139             : 
     140             :     Lexer::pointer_t            f_lexer;
     141             :     Options::pointer_t          f_options;
     142             :     Node::pointer_t             f_root;
     143             :     Node::pointer_t             f_node;    // last data read by get_token()
     144             :     Node::vector_of_pointers_t  f_unget;
     145             : };
     146             : 
     147             : 
     148             : 
     149             : 
     150             : 
     151             : }
     152             : // namespace as2js
     153             : #endif
     154             : // #ifndef AS2JS_PARSER_H
     155             : 
     156             : // vim: ts=4 sw=4 et

Generated by: LCOV version 1.10