|
@ -56,6 +56,7 @@ struct Node |
|
|
char *stringValue; |
|
|
char *stringValue; |
|
|
Node *children[2]; |
|
|
Node *children[2]; |
|
|
}; |
|
|
}; |
|
|
|
|
|
struct String { enum opcode type; char *stringValue; int len;} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -70,7 +71,8 @@ Node *mkNode(enum opcode type) |
|
|
Node *mkString(char *value) |
|
|
Node *mkString(char *value) |
|
|
{ |
|
|
{ |
|
|
Node *node= mkNode(STRING); |
|
|
Node *node= mkNode(STRING); |
|
|
node->stringValue= value; |
|
|
|
|
|
|
|
|
node->String.stringValue= value; |
|
|
|
|
|
node->String.len=strlen(value); |
|
|
return node; |
|
|
return node; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -108,9 +110,9 @@ int execute(Node *node, Exploration *in) |
|
|
{ |
|
|
{ |
|
|
switch (node->type) { |
|
|
switch (node->type) { |
|
|
case STRING: { |
|
|
case STRING: { |
|
|
for (int i=0; i < strlen(node->stringValue);i++) |
|
|
|
|
|
|
|
|
for (int i=0; i < node->String.len);i++) |
|
|
{ |
|
|
{ |
|
|
if (advance(in) != node->stringValue[i]) |
|
|
|
|
|
|
|
|
if (advance(in) != node->String.stringValue[i]) |
|
|
{ |
|
|
{ |
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|