Class: AdLint::Cpp::InIncludeDirective

Inherits:
LexerState
  • Object
show all
Defined in:
lib/adlint/cpp/lexer.rb

Direct Known Subclasses

InIncludeNextDirective

Instance Method Summary collapse

Methods inherited from LexerState

#initialize

Constructor Details

This class inherits a constructor from AdLint::Cpp::LexerState

Instance Method Details

#next_tokenObject



640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
# File 'lib/adlint/cpp/lexer.rb', line 640

def next_token
  until @lexer.content.empty?
    if discard_heading_comments || scan_escaped_newline(@lexer.content)
      next
    end

    tok = tokenize_header_name(@lexer.content) ||
          tokenize_pp_token(@lexer.content)    ||
          tokenize_new_line(@lexer.content)    ||
          tokenize_extra_token(@lexer.content)

    if tok
      break
    else
      @lexer.content.eat!
    end
  end

  unless tok
    tok = Token.new(:NEW_LINE, "\n", @lexer.content.location)
    @lexer.notify_eof_newline_not_found(tok.location)
  end

  if tok.type == :NEW_LINE
    @lexer.transit(Initial.new(@lexer))
  end

  tok
end