Commit bf9bed27 by Aaron Leung

Damn typos in my macros.

parent 521c6ff8
#include <stdio.h> #include <stdio.h>
#include "lexical_patterns.h" #include "lexical_patterns.h"
//#include "prefix_primitives.h"
static SEQUENCE_MATCHER(hyphen_and_id, prefix_is_hyphen, prefix_is_identifier); static SEQUENCE_MATCHER(sign_and_identifier, prefix_is_sign, prefix_is_identifier);
static ALTERNATIVES_MATCHER(word_initial, prefix_is_identifier, prefix_is_hyphen_and_id); static ALTERNATIVES_MATCHER(word_initial, prefix_is_identifier, prefix_is_sign_and_identifier);
static ALTERNATIVES_MATCHER(word_trailer, prefix_is_identifier, prefix_is_hyphen, prefix_is_digits); static ALTERNATIVES_MATCHER(word_trailer, prefix_is_identifier, prefix_is_sign, prefix_is_digits);
FIRST_REST_MATCHER(word, prefix_is_word_initial, prefix_is_word_trailer); FIRST_REST_MATCHER(word, prefix_is_word_initial, prefix_is_word_trailer);
...@@ -14,12 +14,12 @@ char *prefix_is_ ## name(char *src) { \ ...@@ -14,12 +14,12 @@ char *prefix_is_ ## name(char *src) { \
} }
#define CLASS_CHAR_MATCHER(name, class) \ #define CLASS_CHAR_MATCHER(name, class) \
char *prefix_is ## name(char *src) { \ char *prefix_is_ ## name(char *src) { \
return prefix_is_one_of(src, class); \ return prefix_is_one_of(src, class); \
} }
#define CLASS_CHARS_MATCHER(name, class) \ #define CLASS_CHARS_MATCHER(name, class) \
char *prefix_is ## name(char *src) { \ char *prefix_is_ ## name(char *src) { \
return prefix_is_some_of(src, class); \ return prefix_is_some_of(src, class); \
} }
...@@ -148,7 +148,6 @@ DECLARE(eq); ...@@ -148,7 +148,6 @@ DECLARE(eq);
DECLARE(assign); DECLARE(assign);
DECLARE(equal); DECLARE(equal);
char *prefix_is_sign(char *);
DECLARE(sign); DECLARE(sign);
DECLARE(delimiter); DECLARE(delimiter);
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
#include <ctype.h> #include <ctype.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include "prefix_primitives.h" // #include "prefix_primitives.h"
// #include "lexical_patterns.h" #include "lexical_patterns.h"
void print_slice(char *s, char *t) { void print_slice(char *s, char *t) {
if (t) { if (t) {
...@@ -33,7 +33,7 @@ int main() { ...@@ -33,7 +33,7 @@ int main() {
char *words = "hello my name is aaron"; char *words = "hello my name is aaron";
char *id1 = "_identifier123{blah bloo}"; char *id1 = "_identifier123{blah bloo}";
char *non_id = "12non_ident_ifier_"; char *non_id = "12non_ident_ifier_";
char *word2 = "-blah-blah_bl12-34:foo"; char *word2 = "-blah-bl+ah_bl12-34+1:foo";
char *non_word = "-12blah-bloo"; char *non_word = "-12blah-bloo";
char *selector = "#foo > :first-child { color: #abcdef; }"; char *selector = "#foo > :first-child { color: #abcdef; }";
char *lcomment = "// blah blah blah // end\n blah blah"; char *lcomment = "// blah blah blah // end\n blah blah";
...@@ -100,8 +100,8 @@ int main() { ...@@ -100,8 +100,8 @@ int main() {
test1(prefix_is_integer, integer3); test1(prefix_is_integer, integer3);
test1(prefix_is_integer, word2); test1(prefix_is_integer, word2);
// test1(prefix_is_word, word2); test1(prefix_is_word, word2);
// test1(prefix_is_word, non_word); test1(prefix_is_word, integer3);
return 0; return 0;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment