add copying token value and add Boehm GC ready for runtime implimentation
This commit is contained in:
@@ -16,7 +16,7 @@ int yywrap(void *) {
|
||||
|
||||
%%
|
||||
|
||||
(\"(\\[a-z\"'`]|[^\\"])*\") {
|
||||
\"((\\([\"\\\/bfnrt]|u[0-9a-fA-F]{4}))|[^\\\"\n])*\" {
|
||||
GET_STATE
|
||||
Token * token = create_token(
|
||||
TOKEN_STRING,
|
||||
@@ -28,7 +28,7 @@ int yywrap(void *) {
|
||||
ADD_TO_COLUMN
|
||||
}
|
||||
|
||||
('((\\([a-z'\"`]))|[^'])*') {
|
||||
\'((\\([\'\\\/bfnrt]|u[0-9a-fA-F]{4}))|[^\\\'\n])*\' {
|
||||
GET_STATE
|
||||
append(TOKENS, create_token(
|
||||
TOKEN_STRING,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "token.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "../string/string.h"
|
||||
|
||||
Token *create_token(TokenType type, int line, int column, char *value) {
|
||||
Token * token = malloc(sizeof(Token));
|
||||
@@ -8,6 +9,6 @@ Token *create_token(TokenType type, int line, int column, char *value) {
|
||||
token->type = type;
|
||||
token->line=line;
|
||||
token->column=column;
|
||||
token->value=value;
|
||||
token->value=cloneString(value);
|
||||
return token;
|
||||
}
|
||||
Reference in New Issue
Block a user