File: relop_example_token.ads

package info (click to toggle)
libopentoken 3.0b-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,416 kB
  • ctags: 51
  • sloc: ada: 8,561; makefile: 120
file content (36 lines) | stat: -rw-r--r-- 1,532 bytes parent folder | download | duplicates (3)
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
with OpenToken.Recognizer;
package Relop_Example_Token is

   type Instance is new Opentoken.Recognizer.Instance with private;

   ---------------------------------------------------------------------------
   -- This function will be called to create an Identifier token. Note that
   -- this is a simple recognizer, so Get doesn't need any parameters.
   ---------------------------------------------------------------------------
   function Get return Instance;

private

   type State_ID is (First_Char, Equal_or_Greater, Equal, Done);

   type Instance is new Opentoken.Recognizer.Instance with record
      State : State_ID := First_Char;
   end record;

   ---------------------------------------------------------------------------
   -- This procedure will be called when analysis on a new candidate string
   -- is started. The Token needs to clear its state (if any).
   ---------------------------------------------------------------------------
   procedure Clear (The_Token : in out Instance);


   ---------------------------------------------------------------------------
   -- This procedure will be called to perform further analysis on a token
   -- based on the given next character.
   ---------------------------------------------------------------------------
   procedure Analyze (The_Token : in out Instance;
                      Next_Char : in     Character;
                      Verdict   :    out Opentoken.Recognizer.Analysis_Verdict);

end Relop_Example_Token;