• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /macosx-10.10.1/tcl-105/tcl_ext/tcllib/tcllib/modules/pt/tests/data/ok/peg_tclparam-snit/
1## -*- tcl -*-
2##
3## Snit-based Tcl/PARAM implementation of the parsing
4## expression grammar
5##
6##	TEMPLATE
7##
8## Generated from file	TEST
9##            for user  unknown
10##
11# # ## ### ##### ######## ############# #####################
12## Requirements
13
14package require Tcl 8.5
15package require snit
16package require pt::rde ; # Implementation of the PARAM
17			  # virtual machine underlying the
18			  # Tcl/PARAM code used below.
19
20# # ## ### ##### ######## ############# #####################
21##
22
23snit::type ::PARSER {
24    # # ## ### ##### ######## #############
25    ## Public API
26
27    constructor {} {
28	# Create the runtime supporting the parsing process.
29	set myparser [pt::rde ${selfns}::ENGINE]
30	return
31    }
32
33    method parse {channel} {
34	$myparser reset $channel
35	MAIN ; # Entrypoint for the generated code.
36	return [$myparser complete]
37    }
38
39    method parset {text} {
40	$myparser reset
41	$myparser data $text
42	MAIN ; # Entrypoint for the generated code.
43	return [$myparser complete]
44    }
45
46    # # ## ### ###### ######## #############
47    ## Configuration
48
49    pragma -hastypeinfo    0
50    pragma -hastypemethods 0
51    pragma -hasinfo        0
52    pragma -simpledispatch 1
53
54    # # ## ### ###### ######## #############
55    ## Data structures.
56
57    variable myparser {} ; # Our instantiation of the PARAM.
58
59    # # ## ### ###### ######## #############
60    ## BEGIN of GENERATED CODE. DO NOT EDIT.
61
62    #
63    # Grammar Start Expression
64    #
65    
66    proc MAIN {} { upvar 1 myparser myparser
67        sym_Expression
68        return
69    }
70    
71    #
72    # value Symbol 'Expression'
73    #
74    
75    proc sym_Expression {} { upvar 1 myparser myparser
76        # (Function)
77    
78        $myparser si:value_symbol_start Expression
79        sym_Function
80        $myparser si:reduce_symbol_end Expression
81        return
82    }
83    
84    #
85    # value Symbol 'Function'
86    #
87    
88    proc sym_Function {} { upvar 1 myparser myparser
89        # (Sinus)
90    
91        $myparser si:value_symbol_start Function
92        sym_Sinus
93        $myparser si:reduce_symbol_end Function
94        return
95    }
96    
97    #
98    # value Symbol 'Sinus'
99    #
100    
101    proc sym_Sinus {} { upvar 1 myparser myparser
102        # x
103        #     "sin\("
104        #     (Expression)
105        #     '\)'
106    
107        $myparser si:value_symbol_start Sinus
108        sequence_9
109        $myparser si:reduce_symbol_end Sinus
110        return
111    }
112    
113    proc sequence_9 {} { upvar 1 myparser myparser
114        # x
115        #     "sin\("
116        #     (Expression)
117        #     '\)'
118    
119        $myparser si:void_state_push
120        $myparser si:next_str sin\50
121        $myparser si:voidvalue_part
122        sym_Expression
123        $myparser si:valuevalue_part
124        $myparser si:next_char \51
125        $myparser si:value_state_merge
126        return
127    }
128    
129    ## END of GENERATED CODE. DO NOT EDIT.
130    # # ## ### ###### ######## #############
131}
132
133# # ## ### ##### ######## ############# #####################
134## Ready
135
136package provide SNIT_PACKAGE 1
137return
138