Ruby: ext/racc/cparse/cparse.c File Reference

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

Data Structures | Macros | Functions
cparse.c File Reference
`#include <ruby.h>`

Go to the source code of this file.

## Data Structures
struct | cparse_params

## Macros
#define | RACC_VERSION "1.4.15"
#define | DEFAULT_TOKEN -1
#define | ERROR_TOKEN 1
#define | FINAL_TOKEN 0
#define | vDEFAULT_TOKEN INT2FIX(DEFAULT_TOKEN)
#define | vERROR_TOKEN INT2FIX(ERROR_TOKEN)
#define | vFINAL_TOKEN INT2FIX(FINAL_TOKEN)
#define | rb_ary_subseq(ary, beg, len) rb_ary_new4(len, RARRAY_PTR(ary) + beg)
#define | AREF(s, idx) ((0 <= idx && idx < RARRAY_LEN(s)) ? rb_ary_entry(s, idx) : Qnil)
#define | STACK_INIT_LEN 64
#define | NEW_STACK() rb_ary_new2(STACK_INIT_LEN)
#define | PUSH(s, i) rb_ary_store(s, RARRAY_LEN(s), i)
#define | POP(s) rb_ary_pop(s)
#define | LAST_I(s) ((RARRAY_LEN(s) > 0) ? rb_ary_entry(s, RARRAY_LEN(s) - 1) : Qnil)
#define | GET_TAIL(s, len) get_stack_tail(s, len)
#define | CUT_TAIL(s, len) cut_stack_tail(s, len)
#define | CP_FIN_ACCEPT 1
#define | CP_FIN_EOT 2
#define | CP_FIN_CANTPOP 3
#define | D_puts(msg)
#define | D_printf(fmt, arg)
#define | RUBY_UNTYPED_DATA_WARNING 1
#define | SHIFT(v, act, tok, val) shift(v,act,tok,val)
#define | REDUCE(v, act)

## Functions
void | Init_cparse (void)

## Macro Definition Documentation

## ◆ AREF

#define AREF | ( |  | s,
|  |  | idx
| ) |  | ((0 <= idx && idx < RARRAY_LEN(s)) ? rb_ary_entry(s, idx) : Qnil)

Definition at line 97 of file cparse.c.

## ◆ CP_FIN_ACCEPT

#define CP_FIN_ACCEPT 1

Definition at line 180 of file cparse.c.

## ◆ CP_FIN_CANTPOP

#define CP_FIN_CANTPOP 3

Definition at line 182 of file cparse.c.

## ◆ CP_FIN_EOT

#define CP_FIN_EOT 2

Definition at line 181 of file cparse.c.

## ◆ CUT_TAIL

#define CUT_TAIL | ( |  | s,
|  |  | len
| ) |  | cut_stack_tail(s, len)

Definition at line 131 of file cparse.c.

## ◆ D_printf

#define D_printf | ( |  | fmt,
|  |  | arg
| ) |  |

Definition at line 222 of file cparse.c.

## ◆ D_puts

#define D_puts | ( |  | msg | ) |

Definition at line 221 of file cparse.c.

## ◆ DEFAULT_TOKEN

#define DEFAULT_TOKEN -1

Definition at line 29 of file cparse.c.

## ◆ ERROR_TOKEN

#define ERROR_TOKEN 1

Definition at line 30 of file cparse.c.

## ◆ FINAL_TOKEN

#define FINAL_TOKEN 0

Definition at line 31 of file cparse.c.

## ◆ GET_TAIL

#define GET_TAIL | ( |  | s,
|  |  | len
| ) |  | get_stack_tail(s, len)

Definition at line 130 of file cparse.c.

## ◆ LAST_I

#define LAST_I | ( |  | s | ) | ((RARRAY_LEN(s) > 0) ? rb_ary_entry(s, RARRAY_LEN(s) - 1) : Qnil)

Definition at line 128 of file cparse.c.

## ◆ NEW_STACK

#define NEW_STACK | ( |  | ) | rb_ary_new2(STACK_INIT_LEN)

Definition at line 125 of file cparse.c.

## ◆ POP

#define POP | ( |  | s | ) | rb_ary_pop(s)

Definition at line 127 of file cparse.c.

## ◆ PUSH

#define PUSH | ( |  | s,
|  |  | i
| ) |  | rb_ary_store(s, RARRAY_LEN(s), i)

Definition at line 126 of file cparse.c.

## ◆ RACC_VERSION

#define RACC_VERSION "1.4.15"

Definition at line 27 of file cparse.c.

## ◆ rb_ary_subseq

#define rb_ary_subseq | ( |  | ary,
|  |  | beg,
|  |  | len
| ) |  | rb_ary_new4(len, RARRAY_PTR(ary) + beg)

Definition at line 76 of file cparse.c.

## ◆ REDUCE

#define REDUCE | ( |  | v,
|  |  | act
| ) |  |

Value:
do {\
switch (reduce(v,act)) { \
case 0: /* normal */ \
break; \
case 1: /* yyerror */ \
goto user_yyerror; \
case 2: /* yyaccept */ \
D_puts("u accept"); \
goto accept; \
default: \
break; \
} \
} while (0)

Definition at line 464 of file cparse.c.

## ◆ RUBY_UNTYPED_DATA_WARNING

#define RUBY_UNTYPED_DATA_WARNING 1

Definition at line 226 of file cparse.c.

## ◆ SHIFT

#define SHIFT | ( |  | v,
|  |  | act,
|  |  | tok,
|  |  | val
| ) |  | shift(v,act,tok,val)

Definition at line 463 of file cparse.c.

## ◆ STACK_INIT_LEN

#define STACK_INIT_LEN 64

Definition at line 124 of file cparse.c.

## ◆ vDEFAULT_TOKEN

#define vDEFAULT_TOKEN INT2FIX(DEFAULT_TOKEN)

Definition at line 33 of file cparse.c.

## ◆ vERROR_TOKEN

#define vERROR_TOKEN INT2FIX(ERROR_TOKEN)

Definition at line 34 of file cparse.c.

## ◆ vFINAL_TOKEN

#define vFINAL_TOKEN INT2FIX(FINAL_TOKEN)

Definition at line 35 of file cparse.c.

## Function Documentation

## ◆ Init_cparse()

void Init_cparse | ( | void |  | ) |

Definition at line 820 of file cparse.c.

References RACC_VERSION, rb_cObject, rb_const_defined(), rb_const_get(), rb_const_get_at(), rb_define_class_under(), rb_define_const(), rb_define_module(), rb_define_private_method, rb_eRuntimeError, rb_ext_ractor_safe(), rb_str_new2, rb_undef_alloc_func(), and rb_undef_method().