Class: AdLint::Cpp::InElseDirective

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

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



608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
# File 'lib/adlint/cpp/lexer.rb', line 608

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

    tok = 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