NEURON
passn.cpp
Go to the documentation of this file.
1 #include <../../nrnconf.h>
2 /* /local/src/master/nrn/src/modlunit/passn.c,v 1.1.1.1 1994/10/12 17:22:50 hines Exp */
3 
4 /* Returns parse tokens in same order that lexical analyzer did */
5 
6 #include "model.h"
7 #include "parse1.hpp"
8 
9 #define DEBUG 0
10 #if DEBUG
11 static int debugtoken = 1;
12 #else
13 static int debugtoken = 0;
14 #endif
15 
17 int parse_pass = 0;
18 int restart_pass = 0;
19 extern int yylex();
20 
21 void parsepass(int n) {
22  unitonflag = 1;
23  parse_pass = n;
24  if (parse_pass != 1) {
25  lex_tok = intoken;
26  }
27 }
28 
29 void parse_restart(Item* q, int i) {
30  if (i == restart_pass) {
31  restart_pass = 0;
32  return;
33  }
34  restart_pass = i;
36  if (!lex_tok) {
37  lex_tok = intoken;
38  }
39 }
40 
41 int next_intoken(Item** pitem) {
42  if (parse_pass == 1) {
43  return yylex();
44  }
46  if (lex_tok) {
47  *pitem = lex_tok;
48  if (debugtoken) {
49  debugitem(*pitem);
50  }
51  return (*pitem)->itemsubtype;
52  }
53  return 0;
54 }
55 
57  if (!intok) {
58  return ITEM0;
59  }
60  while ((intok = intok->next) != intoken) {
61  /*EMPTY*/
62  if (intok->itemtype == NEWLINE) {
63  ;
64  } else {
65  switch (intok->itemsubtype) {
66  case STUFF:
67  case SPACE:
68  break;
69  default:
70  return intok;
71  }
72  }
73  }
74  return ITEM0;
75 }
76 
78  if (!intok) {
79  return ITEM0;
80  }
81  while ((intok = intok->prev) != intoken) {
82  /*EMPTY*/
83  if (intok->itemtype == NEWLINE) {
84  ;
85  } else {
86  switch (intok->itemsubtype) {
87  case STUFF:
88  case SPACE:
89  break;
90  default:
91  return intok;
92  }
93  }
94  }
95  return ITEM0;
96 }
97 
98 /* passn.c,v
99  * Revision 1.1.1.1 1994/10/12 17:22:50 hines
100  * NEURON 3.0 distribution
101  *
102  * Revision 1.2 91/01/07 14:17:12 hines
103  * in kinunit, wrong itemsubtype. Fix lint messages
104  *
105  * Revision 1.1 90/11/13 16:10:22 hines
106  * Initial revision
107  * */
#define i
Definition: md1redef.h:19
List * intoken
Definition: init.cpp:12
void debugitem(Item *q)
Definition: model.cpp:176
#define ITEM0
Definition: model.h:15
int unitonflag
Definition: units.cpp:34
int const size_t const size_t n
Definition: nrngsl.h:10
size_t q
int next_intoken(Item **pitem)
Definition: passn.cpp:41
static int debugtoken
Definition: passn.cpp:13
int parse_pass
Definition: passn.cpp:17
Item * lex_tok
Definition: passn.cpp:16
void parsepass(int n)
Definition: passn.cpp:21
Item * prev_parstok(Item *intok)
Definition: passn.cpp:77
int yylex()
Definition: hoc.cpp:251
int restart_pass
Definition: passn.cpp:18
Item * next_parstok(Item *intok)
Definition: passn.cpp:56
void parse_restart(Item *q, int i)
Definition: passn.cpp:29
Definition: model.h:8
struct Item * prev
Definition: model.h:13
short itemtype
Definition: model.h:9
short itemsubtype
Definition: model.h:10
struct Item * next
Definition: model.h:12