~ubuntu-branches/debian/squeeze/erlang/squeeze

« back to all changes in this revision

Viewing changes to lib/parsetools/src/yeccgramm.yrl

  • Committer: Bazaar Package Importer
  • Author(s): Erlang Packagers, Sergei Golovan
  • Date: 2006-12-03 17:07:44 UTC
  • mfrom: (2.1.11 feisty)
  • Revision ID: james.westby@ubuntu.com-20061203170744-rghjwupacqlzs6kv
Tags: 1:11.b.2-4
[ Sergei Golovan ]
Fixed erlang-base and erlang-base-hipe prerm scripts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings
14
14
%% AB. All Rights Reserved.''
15
15
%% 
16
 
%%     $Id$
 
16
%%     $Id $
17
17
%%
18
18
 
19
19
%% This is the syntax (metagrammar) of grammar definitions of the yecc
24
24
token tokens.
25
25
 
26
26
Terminals
27
 
atom float integer reserved_symbol string var '->' ':' 'dot'.
 
27
atom float integer reserved_symbol reserved_word string char var
 
28
'->' ':' 'dot'.
28
29
 
29
30
Rootsymbol grammar.
30
31
 
39
40
attached_code -> '$empty' : {erlang_code, [{atom, 0, '$undefined'}]}.
40
41
tokens -> token : ['$1'].
41
42
tokens -> token tokens : ['$1' | '$2'].
42
 
symbol -> var : value_of('$1').
43
 
symbol -> atom : value_of('$1').
44
 
symbol -> integer : value_of('$1').
 
43
symbol -> var : symbol('$1').
 
44
symbol -> atom : symbol('$1').
 
45
symbol -> integer : symbol('$1').
 
46
symbol -> reserved_word : symbol('$1').
45
47
token -> var : '$1'.
46
48
token -> atom : '$1'.
47
49
token -> float : '$1'.
48
50
token -> integer : '$1'.
49
51
token -> string : '$1'.
 
52
token -> char : '$1'.
50
53
token -> reserved_symbol : {value_of('$1'), line_of('$1')}.
 
54
token -> reserved_word : {value_of('$1'), line_of('$1')}.
51
55
token -> '->' : {'->', line_of('$1')}. % Have to be treated in this
52
56
token -> ':' : {':', line_of('$1')}.   % manner, because they are also
53
57
                                       % special symbols of the metagrammar
54
58
 
55
59
Erlang code.
56
60
 
 
61
-record(symbol, {line, name}).
 
62
 
 
63
symbol(Symbol) ->
 
64
    #symbol{line = line_of(Symbol), name = value_of(Symbol)}.
 
65
 
57
66
value_of(Token) ->
58
67
    element(3, Token).
59
68