AAda Compiler Parser Package

8
Feb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
with aada_compiler_token_position;
 
package body aada_compiler_parser_package is
 
procedure next_token(p: in out compiler_parser_type;
                     t: out aada_compiler_token_package.compiler_token_type) is
begin
  if p.unget_count /= 0 then
    t := p.unget(p.unget_count);
    p.unget_count := unget_index'pred(p.unget_count);
    return;
  end if;
 
  aada_compiler_token_package.next_token(p.f, t);
end next_token;
 
procedure unget_token(p: in out compiler_parser_type;
                      t: in aada_compiler_token_package.compiler_token_type) is
begin
  if p.unget_count = unget_index'last then
    raise parser_unget_buffer_full_error;
  end if;
 
  p.unget_count := unget_index'succ(p.unget_count);
  p.unget(p.unget_count) := t;
end unget_token;
 
procedure error(p: in out compiler_parser_type;
                code: in aada_compiler_error_package.errcode;
                token: aada_compiler_token_package.compiler_token_type;
                message: in string) is
  position: aada_compiler_token_position.token_position_type;
begin
  position := aada_compiler_token_package.get_token_position(token);
  aada_compiler_error_package.error(p.e, code, position, message);
end error;
 
 
end aada_compiler_parser_package;
 
-- vim: ts=2 sw=2 et syntax=ada
Project aada v1.0-338 (Project id #3)
Process Done (Last compiled on 2012/01/13 01:21:26)
Description Alexis Ada Compiler written in Ada (my first attempt was in C++ which is not correct for an Ada compiler.)