LCOV - code coverage report
Current view: top level - include/as2js - lexer.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_LEXER_H
       2             : #define AS2JS_LEXER_H
       3             : /* lexer.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             : #include    "as2js/stream.h"
      39             : #include    "as2js/options.h"
      40             : #include    "as2js/node.h"
      41             : 
      42             : 
      43             : namespace as2js
      44             : {
      45             : 
      46             : 
      47     5995339 : class Lexer
      48             : {
      49             : public:
      50             :     typedef std::shared_ptr<Lexer>      pointer_t;
      51             : 
      52             :                                 Lexer(Input::pointer_t input, Options::pointer_t options);
      53             : 
      54             :     Input::pointer_t            get_input() const;
      55             : 
      56             :     Node::pointer_t             get_new_node(Node::node_t type);
      57             :     Node::pointer_t             get_next_token();
      58             : 
      59             : private:
      60             :     typedef int                 char_type_t;
      61             : 
      62             :     static char_type_t const    CHAR_NO_FLAGS        = 0x0000;
      63             :     static char_type_t const    CHAR_LETTER          = 0x0001;
      64             :     static char_type_t const    CHAR_DIGIT           = 0x0002;
      65             :     static char_type_t const    CHAR_PUNCTUATION     = 0x0004;
      66             :     static char_type_t const    CHAR_WHITE_SPACE     = 0x0008;
      67             :     static char_type_t const    CHAR_LINE_TERMINATOR = 0x0010;
      68             :     static char_type_t const    CHAR_HEXDIGIT        = 0x0020;
      69             :     static char_type_t const    CHAR_INVALID         = 0x8000;   // such as 0xFFFE & 0xFFFF
      70             : 
      71             :     typedef controlled_vars::auto_init<char_type_t, CHAR_NO_FLAGS>  zchar_type_t;
      72             : 
      73             :     void                        get_token();
      74             :     Input::char_t               getc();
      75             :     void                        ungetc(Input::char_t c);
      76             :     int64_t                     read_hex(unsigned long max);
      77             :     int64_t                     read_binary(unsigned long max);
      78             :     int64_t                     read_octal(Input::char_t c, unsigned long max);
      79             :     Input::char_t               escape_sequence(bool accept_continuation);
      80             :     char_type_t                 char_type(Input::char_t c);
      81             :     Input::char_t               read(Input::char_t c, char_type_t flags, String& str);
      82             :     void                        read_identifier(Input::char_t c);
      83             :     void                        read_number(Input::char_t c);
      84             :     void                        read_string(Input::char_t quote);
      85             :     bool                        has_option_set(Options::option_t option) const;
      86             : 
      87             :     std::vector<Input::char_t>  f_unget;
      88             :     Input::pointer_t            f_input;
      89             :     Options::pointer_t          f_options;
      90             :     zchar_type_t                f_char_type;    // type of the last character read
      91             :     Position                    f_position;     // position just before reading a token
      92             : 
      93             :     Node::safe_node_t           f_result_type;
      94             :     String                      f_result_string;
      95             :     Int64                       f_result_int64;
      96             :     Float64                     f_result_float64;
      97             : };
      98             : 
      99             : 
     100             : 
     101             : }
     102             : // namespace as2js
     103             : #endif
     104             : // #ifndef AS2JS_LEXER_H
     105             : 
     106             : // vim: ts=4 sw=4 et

Generated by: LCOV version 1.10