leo před 4 roky
rodič
revize
93ff7e031d
1 změnil soubory, kde provedl 5 přidání a 3 odebrání
  1. +5
    -3
      lexer.c

+ 5
- 3
lexer.c Zobrazit soubor

@ -56,6 +56,7 @@ struct Node
char *stringValue;
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 *node= mkNode(STRING);
node->stringValue= value;
node->String.stringValue= value;
node->String.len=strlen(value);
return node;
}
@ -108,9 +110,9 @@ int execute(Node *node, Exploration *in)
{
switch (node->type) {
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;
}

Načítá se…
Zrušit
Uložit