# Class: YARD::Parser::C::CParser

Inherits:
  Base
  - Object
  - Base
  - YARD::Parser::C::CParser
  show all

Defined in:
  lib/yard/parser/c/c_parser.rb

## Instance Method Summary collapse

- #enumerator ⇒ Object
- #initialize(source, file = '(stdin)') ⇒ CParser constructor

  A new instance of CParser.

- #parse ⇒ Object
- #tokenize ⇒ Object

## Constructor Details

### #initialize(source, file = '(stdin)') ⇒ `CParser`

Returns a new instance of CParser.

    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17

    # File 'lib/yard/parser/c/c_parser.rb', line 6

    def initialize(source, file = '(stdin)')
      @file = file
      @namespaces = {}
      @content = source
      @index = 0
      @line = 1
      @state = nil
      @newline = true
      @statements = []
      @last_comment = nil
      @last_statement = nil
    end

## Instance Method Details

### #enumerator ⇒ `Object`

    24
    25
    26

    # File 'lib/yard/parser/c/c_parser.rb', line 24

    def enumerator
      @statements
    end

### #parse ⇒ `Object`

    19
    20
    21
    22

    # File 'lib/yard/parser/c/c_parser.rb', line 19

    def parse
      parse_toplevel
      enumerator
    end

### #tokenize ⇒ `Object`

Raises:

- (`NotImplementedError`)

    28
    29
    30

    # File 'lib/yard/parser/c/c_parser.rb', line 28

    def tokenize
      raise NotImplementedError, "no tokenization support for C/C++ files"
    end