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