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
16
Item
*
lex_tok
;
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
;
35
lex_tok
=
prev_parstok
(
q
);
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
}
45
lex_tok
=
next_parstok
(
lex_tok
);
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
56
Item
*
next_parstok
(
Item
* intok) {
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
77
Item
*
prev_parstok
(
Item
* intok) {
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
* */
i
#define i
Definition:
md1redef.h:19
intoken
List * intoken
Definition:
init.cpp:12
debugitem
void debugitem(Item *q)
Definition:
model.cpp:176
model.h
ITEM0
#define ITEM0
Definition:
model.h:15
unitonflag
int unitonflag
Definition:
units.cpp:34
n
int const size_t const size_t n
Definition:
nrngsl.h:10
q
size_t q
Definition:
nrngsl_hc_radix2.cpp:49
next_intoken
int next_intoken(Item **pitem)
Definition:
passn.cpp:41
debugtoken
static int debugtoken
Definition:
passn.cpp:13
parse_pass
int parse_pass
Definition:
passn.cpp:17
lex_tok
Item * lex_tok
Definition:
passn.cpp:16
parsepass
void parsepass(int n)
Definition:
passn.cpp:21
prev_parstok
Item * prev_parstok(Item *intok)
Definition:
passn.cpp:77
yylex
int yylex()
Definition:
hoc.cpp:251
restart_pass
int restart_pass
Definition:
passn.cpp:18
next_parstok
Item * next_parstok(Item *intok)
Definition:
passn.cpp:56
parse_restart
void parse_restart(Item *q, int i)
Definition:
passn.cpp:29
Item
Definition:
model.h:8
Item::prev
struct Item * prev
Definition:
model.h:13
Item::itemtype
short itemtype
Definition:
model.h:9
Item::itemsubtype
short itemsubtype
Definition:
model.h:10
Item::next
struct Item * next
Definition:
model.h:12
src
modlunit
passn.cpp