Class: AdLint::Cpp::InIfdefDirective

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

Direct Known Subclasses

InIfndefDirective

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



573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
# File 'lib/adlint/cpp/lexer.rb', line 573

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

    tok = tokenize_identifier(@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