简体   繁体   中英

yacc: What does %{} mean in yacc?

Does it mean just copy the C code? This is excerpted from ruby source code parse.y

%{

#ifndef PARSER_DEBUG
#define PARSER_DEBUG 0
#endif
#define YYDEBUG 1
#define YYERROR_VERBOSE 1
#define YYSTACK_USE_ALLOCA 0

#include "ruby/ruby.h"
#include "ruby/st.h"
#include "ruby/encoding.h"

The definition section is to be put within the %{ and %}

The definitions section consists of token declarations and C code bracketed by "%{" and "%}".

DOC

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM