ソースを参照

? expression

main
leo 4年前
コミット
93ff7e031d
1個のファイルの変更5行の追加3行の削除
  1. +5
    -3
      lexer.c

+ 5
- 3
lexer.c ファイルの表示

@ -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;
}

読み込み中…
キャンセル
保存