Back to index

texmacs  1.0.7.15
Classes | Defines | Functions | Variables
packrat_grammar.hpp File Reference
#include "packrat.hpp"
#include "array.hpp"
#include "hashmap.hpp"
#include "resource.hpp"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  packrat_grammar_rep

Defines

#define C   int
#define D   long long int
#define PACKRAT_TOKENS   ((C) 0)
#define PACKRAT_OR   ((C) 100000000)
#define PACKRAT_CONCAT   ((C) 100000001)
#define PACKRAT_WHILE   ((C) 100000002)
#define PACKRAT_REPEAT   ((C) 100000003)
#define PACKRAT_RANGE   ((C) 100000004)
#define PACKRAT_NOT   ((C) 100000005)
#define PACKRAT_EXCEPT   ((C) 100000006)
#define PACKRAT_PARTIAL   ((C) 100000007)
#define PACKRAT_TM_OPEN   ((C) 100000010)
#define PACKRAT_TM_ANY   ((C) 100000011)
#define PACKRAT_TM_ARGS   ((C) 100000012)
#define PACKRAT_TM_LEAF   ((C) 100000013)
#define PACKRAT_TM_CHAR   ((C) 100000014)
#define PACKRAT_TM_CURSOR   ((C) 100000015)
#define PACKRAT_TM_FAIL   ((C) 100000016)
#define PACKRAT_SYMBOLS   ((C) 100000020)

Functions

 RESOURCE (packrat_grammar)
C encode_token (string s)
array< Cencode_tokens (string s)
C encode_symbol (tree t)
packrat_grammar find_packrat_grammar (string s)

Variables

int packrat_nr_tokens
int packrat_nr_symbols
hashmap< string, Cpackrat_tokens
hashmap< tree, Cpackrat_symbols
hashmap< C, treepackrat_decode
tree packrat_uninit

Define Documentation

#define C   int

Definition at line 24 of file packrat_grammar.hpp.

#define D   long long int

Definition at line 25 of file packrat_grammar.hpp.

#define PACKRAT_CONCAT   ((C) 100000001)

Definition at line 36 of file packrat_grammar.hpp.

#define PACKRAT_EXCEPT   ((C) 100000006)

Definition at line 41 of file packrat_grammar.hpp.

#define PACKRAT_NOT   ((C) 100000005)

Definition at line 40 of file packrat_grammar.hpp.

#define PACKRAT_OR   ((C) 100000000)

Definition at line 35 of file packrat_grammar.hpp.

#define PACKRAT_PARTIAL   ((C) 100000007)

Definition at line 42 of file packrat_grammar.hpp.

#define PACKRAT_RANGE   ((C) 100000004)

Definition at line 39 of file packrat_grammar.hpp.

#define PACKRAT_REPEAT   ((C) 100000003)

Definition at line 38 of file packrat_grammar.hpp.

#define PACKRAT_SYMBOLS   ((C) 100000020)

Definition at line 50 of file packrat_grammar.hpp.

#define PACKRAT_TM_ANY   ((C) 100000011)

Definition at line 44 of file packrat_grammar.hpp.

#define PACKRAT_TM_ARGS   ((C) 100000012)

Definition at line 45 of file packrat_grammar.hpp.

#define PACKRAT_TM_CHAR   ((C) 100000014)

Definition at line 47 of file packrat_grammar.hpp.

#define PACKRAT_TM_CURSOR   ((C) 100000015)

Definition at line 48 of file packrat_grammar.hpp.

#define PACKRAT_TM_FAIL   ((C) 100000016)

Definition at line 49 of file packrat_grammar.hpp.

#define PACKRAT_TM_LEAF   ((C) 100000013)

Definition at line 46 of file packrat_grammar.hpp.

#define PACKRAT_TM_OPEN   ((C) 100000010)

Definition at line 43 of file packrat_grammar.hpp.

#define PACKRAT_TOKENS   ((C) 0)

Definition at line 34 of file packrat_grammar.hpp.

#define PACKRAT_WHILE   ((C) 100000002)

Definition at line 37 of file packrat_grammar.hpp.


Function Documentation

Definition at line 79 of file packrat_grammar.cpp.

                       {
  if (!packrat_symbols->contains (t)) {
    C sym= new_symbol (t);
    packrat_symbols (t)= sym;
    packrat_decode  (sym)= t;
  }
  return packrat_symbols[t];
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 43 of file packrat_grammar.cpp.

                        {
  if (!packrat_tokens->contains (s)) {
    int pos= 0;
    tm_char_forwards (s, pos);
    if (pos == 0 || pos != N(s)) return -1;
    C sym= new_token (s);
    packrat_tokens (s)= sym;
    packrat_decode (sym)= s;
  }
  return packrat_tokens[s];
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 56 of file packrat_grammar.cpp.

                         {
  int pos= 0;
  array<C> ret;
  while (pos < N(s)) {
    int old= pos;
    tm_char_forwards (s, pos);
    ret << encode_token (s (old, pos));
  }
  return ret;
}

Here is the call graph for this function:

Here is the caller graph for this function:

packrat_grammar find_packrat_grammar ( string  s)

Definition at line 266 of file packrat_grammar.cpp.

                                {
  if (packrat_grammar::instances -> contains (s)) return packrat_grammar (s);
  eval ("(lazy-language-force " * s * ")");
  return make_packrat_grammar (s);
}

Here is the call graph for this function:

Here is the caller graph for this function:

RESOURCE ( packrat_grammar  )

Variable Documentation

Definition at line 18 of file packrat_grammar.cpp.

Definition at line 17 of file packrat_grammar.cpp.

Definition at line 20 of file packrat_grammar.cpp.

Definition at line 19 of file packrat_grammar.cpp.