module Rucc::Lexer::Preprocessor::Constructor

Public Instance Methods

copy_token(tok) click to toggle source

@param [Token] tok @return [Token]

# File lib/rucc/lexer/preprocessor/constructor.rb, line 48
def copy_token(tok)
  tok.dup
end
define_obj_macro(name, value) click to toggle source

@param [String] name @param [Token] value

# File lib/rucc/lexer/preprocessor/constructor.rb, line 7
def define_obj_macro(name, value)
  @macros[name] = make_obj_macro([value])
end
make_cond_incl(wastrue) click to toggle source

@param [Boolean] wastrue

# File lib/rucc/lexer/preprocessor/constructor.rb, line 30
def make_cond_incl(wastrue)
  CondIncl.new(CondInclCtx::THEN, wastrue: wastrue)
end
make_func_macro(body, nargs, is_varg) click to toggle source

@param [<Token>] body @param [Integer] nargs @param [Boolean] is_varg

# File lib/rucc/lexer/preprocessor/constructor.rb, line 20
def make_func_macro(body, nargs, is_varg)
  Macro.new(M::FUNC, body: body, nargs: nargs, is_varg: is_varg)
end
make_macro_token(position, is_vararg) click to toggle source

@param [Integer] position @param [Boolean] is_vararg

# File lib/rucc/lexer/preprocessor/constructor.rb, line 36
def make_macro_token(position, is_vararg)
  Token.new(T::MACRO_PARAM,
            is_vararg: is_vararg,
            hideset: nil,
            position: position,
            space: false,
            bol: false,
           )
end
make_obj_macro(body) click to toggle source

@param [<Token>] body @return [Macro]

# File lib/rucc/lexer/preprocessor/constructor.rb, line 13
def make_obj_macro(body)
  Macro.new(M::OBJ, body: body)
end
make_special_macro(fn) click to toggle source

@param [Proc] fn

# File lib/rucc/lexer/preprocessor/constructor.rb, line 25
def make_special_macro(fn)
  Macro.new(M::SPECIAL, fn: fn)
end