Mercurial > hg > Members > masakoha > testcode
annotate c/regexParser/main.cc @ 62:a49b4a8b8c14
implement isLiteral
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 14 Jul 2015 16:45:07 +0900 |
parents | 67cade0e35b0 |
children | 8fd3d35e9861 |
rev | line source |
---|---|
55 | 1 /* |
56
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2 * <literal> ::= [a-z][A-Z][0-9] |
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
3 * <charClass> ::= '['<literal>'-'<literal>']' |
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
4 * <string> ::= <literal><literal>* |
58
4053c3e0fa7f
implement group()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
5 * <group> ::= '('<regex>')' |
4053c3e0fa7f
implement group()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
6 * <or> ::= <regex>'|'<regex> |
56
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
7 * <*> ::= <regex>'*' |
58
4053c3e0fa7f
implement group()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
8 * <regex> ::= <string>|<or>|<charClass>|<group>|<*> |
55 | 9 */ |
10 | |
45 | 11 #include <stdio.h> |
56
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
12 #include <stdlib.h> |
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
13 #include <string.h> |
57
71b497d25273
fix literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
14 |
56
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
15 typedef struct node { |
58
4053c3e0fa7f
implement group()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
16 struct node *self; |
57
71b497d25273
fix literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
17 char character; |
56
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
18 struct node *left; |
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
19 struct node *right; |
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
20 } Node, *NodePtr; |
52
a2826bf4e80a
remove magic number
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
51
diff
changeset
|
21 |
58
4053c3e0fa7f
implement group()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
22 char *ptr; |
4053c3e0fa7f
implement group()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
23 NodePtr regexHeadNode; |
4053c3e0fa7f
implement group()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
24 |
56
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
25 NodePtr charClass(); |
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
26 NodePtr string(); |
58
4053c3e0fa7f
implement group()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
27 NodePtr group(); |
56
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
28 NodePtr _or(); |
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
29 NodePtr asterisk(); |
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
30 NodePtr regex(); |
57
71b497d25273
fix literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
31 NodePtr createNode(char,NodePtr,NodePtr); |
55 | 32 |
62
a49b4a8b8c14
implement isLiteral
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
61
diff
changeset
|
33 bool isLiteral(char c) { |
a49b4a8b8c14
implement isLiteral
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
61
diff
changeset
|
34 if (('a'<=c && c<='z')||('A'<=c && c<='Z')||('0'<=c && c<='9')) { |
a49b4a8b8c14
implement isLiteral
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
61
diff
changeset
|
35 return true; |
a49b4a8b8c14
implement isLiteral
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
61
diff
changeset
|
36 } |
a49b4a8b8c14
implement isLiteral
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
61
diff
changeset
|
37 return false; |
a49b4a8b8c14
implement isLiteral
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
61
diff
changeset
|
38 } |
a49b4a8b8c14
implement isLiteral
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
61
diff
changeset
|
39 |
60
8616a045a7f4
impl asterisk
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
59
diff
changeset
|
40 void printNodeDate(NodePtr n) { |
8616a045a7f4
impl asterisk
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
59
diff
changeset
|
41 puts("---------------------"); |
8616a045a7f4
impl asterisk
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
59
diff
changeset
|
42 printf("Self Node char : %c\n", n->character); |
8616a045a7f4
impl asterisk
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
59
diff
changeset
|
43 printf("Self Node addr : %p\n", n->self); |
8616a045a7f4
impl asterisk
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
59
diff
changeset
|
44 printf("left Node addr : %p\n", n->left); |
8616a045a7f4
impl asterisk
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
59
diff
changeset
|
45 printf("right Node addr : %p\n", n->right); |
8616a045a7f4
impl asterisk
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
59
diff
changeset
|
46 puts("---------------------"); |
8616a045a7f4
impl asterisk
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
59
diff
changeset
|
47 puts(""); |
8616a045a7f4
impl asterisk
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
59
diff
changeset
|
48 } |
8616a045a7f4
impl asterisk
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
59
diff
changeset
|
49 |
57
71b497d25273
fix literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
50 NodePtr createNode(char character, NodePtr left, NodePtr right) { |
71b497d25273
fix literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
51 NodePtr n = (NodePtr)malloc(sizeof(Node)); |
58
4053c3e0fa7f
implement group()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
52 n->self = n; |
56
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
53 n->character = character; |
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
54 n->left = left; |
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
55 n->right = right; |
58
4053c3e0fa7f
implement group()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
56 |
60
8616a045a7f4
impl asterisk
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
59
diff
changeset
|
57 printNodeDate(n); |
56
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
58 return n; |
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
59 } |
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
60 |
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
61 // <charClass> ::= '['<literal>'-'<literal>']' |
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
62 NodePtr charClass() { |
62
a49b4a8b8c14
implement isLiteral
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
61
diff
changeset
|
63 ptr++; |
a49b4a8b8c14
implement isLiteral
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
61
diff
changeset
|
64 NodePtr n = (NodePtr)malloc(sizeof(Node)); |
a49b4a8b8c14
implement isLiteral
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
61
diff
changeset
|
65 return n; |
56
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
66 } |
55 | 67 |
56
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
68 // <literal> ::= [a-z][A-Z][0-9] |
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
69 NodePtr literal() { |
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
70 char c = *ptr; |
57
71b497d25273
fix literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
71 NodePtr n = createNode(c,0,0); |
71b497d25273
fix literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
72 ptr++; |
71b497d25273
fix literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
73 return n; |
56
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
74 } |
55 | 75 |
56
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
76 // <string> ::= <literal><literal>* |
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
77 NodePtr string() { |
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
78 char c = *ptr; |
58
4053c3e0fa7f
implement group()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
79 NodePtr n = NULL; |
61
67cade0e35b0
impl isLiteral
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
60
diff
changeset
|
80 if (isLiteral(c)) { |
56
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
81 n = createNode(0,literal(),string()); |
55 | 82 } else { |
56
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
83 n = createNode(0,0,0); |
55 | 84 } |
58
4053c3e0fa7f
implement group()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
85 return n; |
55 | 86 } |
87 | |
58
4053c3e0fa7f
implement group()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
88 // <group> ::= '('<regex>')' | '('<regex>'|'<regex>')' |
4053c3e0fa7f
implement group()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
89 NodePtr group() { |
4053c3e0fa7f
implement group()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
90 NodePtr n; |
4053c3e0fa7f
implement group()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
91 if (*ptr == ')') { |
4053c3e0fa7f
implement group()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
92 n = createNode(0,0,0); |
4053c3e0fa7f
implement group()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
93 ptr++; |
4053c3e0fa7f
implement group()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
94 } else { |
4053c3e0fa7f
implement group()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
95 ptr++; |
4053c3e0fa7f
implement group()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
96 n = regex(); |
4053c3e0fa7f
implement group()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
97 } |
4053c3e0fa7f
implement group()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
98 return n; |
4053c3e0fa7f
implement group()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
99 } |
4053c3e0fa7f
implement group()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
100 |
4053c3e0fa7f
implement group()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
101 |
4053c3e0fa7f
implement group()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
102 // <or> ::= <regex>'|'<regex> |
56
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
103 NodePtr _or() { |
59 | 104 ptr++; |
58
4053c3e0fa7f
implement group()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
105 NodePtr n = createNode('|',regexHeadNode,regex()); |
4053c3e0fa7f
implement group()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
106 return n; |
55 | 107 } |
108 | |
56
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
109 // <*> ::= <regex>'*' |
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
110 NodePtr asterisk() { |
60
8616a045a7f4
impl asterisk
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
59
diff
changeset
|
111 ptr++; |
8616a045a7f4
impl asterisk
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
59
diff
changeset
|
112 NodePtr n = createNode('*',regexHeadNode,regex()); |
8616a045a7f4
impl asterisk
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
59
diff
changeset
|
113 return n; |
55 | 114 } |
115 | |
58
4053c3e0fa7f
implement group()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
116 // <regex> ::= <string>|<or>|<charClass>|<group>|<*> |
56
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
117 NodePtr regex() { |
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
118 |
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
119 NodePtr n; |
49
f76fe618d5a7
implement bitset
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
48
diff
changeset
|
120 |
58
4053c3e0fa7f
implement group()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
121 while (*ptr != '\0') { |
4053c3e0fa7f
implement group()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
122 if ((*ptr == '(') || (*ptr == ')')) { |
4053c3e0fa7f
implement group()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
123 n = group(); |
4053c3e0fa7f
implement group()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
124 } else if (*ptr == '[') { |
4053c3e0fa7f
implement group()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
125 n = charClass(); |
4053c3e0fa7f
implement group()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
126 } else if (*ptr == '|'){ |
57
71b497d25273
fix literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
127 n = _or(); |
60
8616a045a7f4
impl asterisk
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
59
diff
changeset
|
128 } else if (*ptr == '*'){ |
8616a045a7f4
impl asterisk
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
59
diff
changeset
|
129 n = asterisk(); |
56
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
130 } else { |
57
71b497d25273
fix literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
131 n = string(); |
58
4053c3e0fa7f
implement group()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
132 regexHeadNode = n; |
56
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
133 } |
55 | 134 } |
56
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
135 return n; |
55 | 136 } |
137 | |
62
a49b4a8b8c14
implement isLiteral
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
61
diff
changeset
|
138 int main(int argc, char **argv) |
55 | 139 { |
56
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
140 for (int i = 1; i < argc; i++) { |
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
141 if (strcmp(argv[i],"-regex") == 0) { |
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
142 ptr = argv[i+1]; i++; |
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
143 } |
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
144 } |
55 | 145 |
56
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
146 printf("regex : %s\n",ptr); |
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
147 NodePtr n = regex(); |
45 | 148 return 0; |
149 } |