summaryrefslogtreecommitdiff
path: root/ext/ripper/ripper.rb.in
diff options
context:
space:
mode:
Diffstat (limited to 'ext/ripper/ripper.rb.in')
-rw-r--r--ext/ripper/ripper.rb.in47
1 files changed, 29 insertions, 18 deletions
diff --git a/ext/ripper/ripper.rb.in b/ext/ripper/ripper.rb.in
index fd155cb7bd2..55472064283 100644
--- a/ext/ripper/ripper.rb.in
+++ b/ext/ripper/ripper.rb.in
@@ -1,9 +1,4 @@
#
-# This file is automatically generated from ripper.rb.in and parse.y.
-# DO NOT MODIFY!!!!!!
-#
-
-#
# ripper.rb
#
# Copyright (C) 2003,2004 Minero Aoki
@@ -12,10 +7,37 @@
require 'ripper.so'
class Ripper
- def Ripper.parse(str, *args)
- new(str, *args).parse
+ # Parses Ruby program read from _src_.
+ # _src_ must be a String or a IO or a object which has #gets method.
+ def Ripper.parse(src, filename = '(ripper)', lineno = 1)
+ new(src, filename, lineno).parse
end
+ # This table contains name of parser events and its arity.
+ PARSER_EVENT_TABLE = {
+#include ids1
+ }
+
+ # This array contains name of parser events.
+ PARSER_EVENTS = PARSER_EVENT_TABLE.keys
+
+ # This table contains name of scanner events and its arity
+ # (arity is always 1 for all scanner events).
+ # on__scan is NOT a scanner event.
+ SCANNER_EVENT_TABLE = {
+#include ids2
+ }
+
+ # This array contains name of scanner events.
+ SCANNER_EVENTS = SCANNER_EVENT_TABLE.keys
+
+ # This table contains name of all ripper events, except on__scan.
+ EVENTS = PARSER_EVENTS + SCANNER_EVENTS
+
+ ### ###
+ ### Event Handlers ###
+ ### ###
+
private
def warn(fmt, *args)
@@ -27,17 +49,6 @@ class Ripper
def compile_error(msg)
end
- PARSER_EVENTS = [
-#include ids1
- ]
-
- SCANNER_EVENTS = [
-#include ids2
- ]
- LEXER_EVENTS = SCANNER_EVENTS
-
- EVENTS = PARSER_EVENTS + SCANNER_EVENTS
-
#
# Parser Events
#