LCOV - code coverage report
Current view: top level - as2js/lib - parser_program.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 17 17 100.0 %
Date: 2014-08-10 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* parser_program.cpp -- written by Alexis WILKE for Made to Order Software Corp. (c) 2005-2014 */
       2             : 
       3             : /*
       4             : 
       5             : Copyright (c) 2005-2014 Made to Order Software Corp.
       6             : 
       7             : http://snapwebsites.org/project/as2js
       8             : 
       9             : Permission is hereby granted, free of charge, to any
      10             : person obtaining a copy of this software and
      11             : associated documentation files (the "Software"), to
      12             : deal in the Software without restriction, including
      13             : without limitation the rights to use, copy, modify,
      14             : merge, publish, distribute, sublicense, and/or sell
      15             : copies of the Software, and to permit persons to whom
      16             : the Software is furnished to do so, subject to the
      17             : following conditions:
      18             : 
      19             : The above copyright notice and this permission notice
      20             : shall be included in all copies or substantial
      21             : portions of the Software.
      22             : 
      23             : THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
      24             : ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
      25             : LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
      26             : FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
      27             : EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
      28             : LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
      29             : WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
      30             : ARISING FROM, OUT OF OR IN CONNECTION WITH THE
      31             : SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
      32             : SOFTWARE.
      33             : 
      34             : */
      35             : 
      36             : #include    "as2js/parser.h"
      37             : #include    "as2js/message.h"
      38             : 
      39             : 
      40             : namespace as2js
      41             : {
      42             : 
      43             : 
      44             : /**********************************************************************/
      45             : /**********************************************************************/
      46             : /***  PARSER PROGRAM  *************************************************/
      47             : /**********************************************************************/
      48             : /**********************************************************************/
      49             : 
      50     1097862 : void Parser::program(Node::pointer_t& node)
      51             : {
      52     1097862 :     node = f_lexer->get_new_node(Node::node_t::NODE_PROGRAM);
      53     2187531 :     while(f_node->get_type() != Node::node_t::NODE_EOF)
      54             :     {
      55     1089669 :         Node::pointer_t directives;
      56     1089669 :         directive_list(directives);
      57     1089669 :         node->append_child(directives);
      58             : 
      59     1089669 :         if(f_node->get_type() == Node::node_t::NODE_ELSE)
      60             :         {
      61       16386 :             Message msg(message_level_t::MESSAGE_LEVEL_ERROR, err_code_t::AS_ERR_INVALID_KEYWORD, f_lexer->get_input()->get_position());
      62       16386 :             msg << "'else' not expected without an 'if' keyword.";
      63       16386 :             get_token();
      64             :         }
      65     1073283 :         else if(f_node->get_type() == Node::node_t::NODE_CLOSE_CURVLY_BRACKET)
      66             :         {
      67       32772 :             Message msg(message_level_t::MESSAGE_LEVEL_ERROR, err_code_t::AS_ERR_CURVLY_BRACKETS_EXPECTED, f_lexer->get_input()->get_position());
      68       32772 :             msg << "'}' not expected without a '{'.";
      69       32772 :             get_token();
      70             :         }
      71     1089669 :     }
      72     1097862 : }
      73             : 
      74             : 
      75             : 
      76             : 
      77             : 
      78          20 : }
      79             : // namespace as2js
      80             : 
      81             : // vim: ts=4 sw=4 et

Generated by: LCOV version 1.9