asm: add missing includes
This commit is contained in:
19
asm/lex.c
19
asm/lex.c
@@ -1,15 +1,17 @@
|
|||||||
|
#include "lex.h"
|
||||||
|
|
||||||
#include <blue/core/hash.h>
|
#include <blue/core/hash.h>
|
||||||
#include <blue/core/queue.h>
|
#include <blue/core/queue.h>
|
||||||
#include <blue/object/string.h>
|
|
||||||
#include <blue/object/dict.h>
|
#include <blue/object/dict.h>
|
||||||
#include <blue/object/number.h>
|
#include <blue/object/number.h>
|
||||||
|
#include <blue/object/string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <ivy/asm/lex.h>
|
#include <ivy/asm/lex.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "lex.h"
|
#include <wctype.h>
|
||||||
|
|
||||||
#define LINEBUF_DEFAULT_CAPACITY 1024
|
#define LINEBUF_DEFAULT_CAPACITY 1024
|
||||||
|
|
||||||
@@ -201,7 +203,8 @@ static void init_keywords(b_dict *keyword_dict)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum ivy_keyword find_keyword_by_name(struct ivy_asm_lexer *lex, const char *s)
|
static enum ivy_asm_keyword find_keyword_by_name(
|
||||||
|
struct ivy_asm_lexer *lex, const char *s)
|
||||||
{
|
{
|
||||||
b_number *id = B_NUMBER(b_dict_at(lex->lex_keywords, s));
|
b_number *id = B_NUMBER(b_dict_at(lex->lex_keywords, s));
|
||||||
if (!id) {
|
if (!id) {
|
||||||
@@ -364,7 +367,7 @@ static int advance(struct ivy_asm_lexer *lex)
|
|||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool input_available(struct ivy_asm_lexer* lex)
|
static bool input_available(struct ivy_asm_lexer *lex)
|
||||||
{
|
{
|
||||||
return lex->lex_linebuf_ptr < lex->lex_linebuf_len;
|
return lex->lex_linebuf_ptr < lex->lex_linebuf_len;
|
||||||
}
|
}
|
||||||
@@ -393,7 +396,8 @@ static struct ivy_asm_token *create_token(enum ivy_asm_token_type type)
|
|||||||
return tok;
|
return tok;
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum ivy_status push_token(struct ivy_asm_lexer *lex, struct ivy_asm_token *tok)
|
static enum ivy_status push_token(
|
||||||
|
struct ivy_asm_lexer *lex, struct ivy_asm_token *tok)
|
||||||
{
|
{
|
||||||
struct ivy_asm_token **slot = &lex->lex_queue;
|
struct ivy_asm_token **slot = &lex->lex_queue;
|
||||||
|
|
||||||
@@ -495,7 +499,8 @@ static enum ivy_status push_double(struct ivy_asm_lexer *lex, double v)
|
|||||||
return push_token(lex, tok);
|
return push_token(lex, tok);
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum ivy_status push_keyword(struct ivy_asm_lexer *lex, enum ivy_keyword keyword)
|
static enum ivy_status push_keyword(
|
||||||
|
struct ivy_asm_lexer *lex, enum ivy_asm_keyword keyword)
|
||||||
{
|
{
|
||||||
struct ivy_asm_token *tok = malloc(sizeof *tok);
|
struct ivy_asm_token *tok = malloc(sizeof *tok);
|
||||||
if (!tok) {
|
if (!tok) {
|
||||||
@@ -835,7 +840,7 @@ static enum ivy_status read_keyword(struct ivy_asm_lexer *lex)
|
|||||||
|
|
||||||
const char *s = b_string_ptr(str);
|
const char *s = b_string_ptr(str);
|
||||||
|
|
||||||
enum ivy_keyword keyword = find_keyword_by_name(lex, s);
|
enum ivy_asm_keyword keyword = find_keyword_by_name(lex, s);
|
||||||
|
|
||||||
if (keyword == IVY_ASM_KW_NONE) {
|
if (keyword == IVY_ASM_KW_NONE) {
|
||||||
return IVY_ERR_BAD_SYNTAX;
|
return IVY_ERR_BAD_SYNTAX;
|
||||||
|
|||||||
@@ -2,8 +2,9 @@
|
|||||||
#define _LEX_H_
|
#define _LEX_H_
|
||||||
|
|
||||||
#include <blue/core/queue.h>
|
#include <blue/core/queue.h>
|
||||||
#include <blue/object/string.h>
|
|
||||||
#include <blue/object/dict.h>
|
#include <blue/object/dict.h>
|
||||||
|
#include <blue/object/string.h>
|
||||||
|
#include <ivy/asm/lex.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
enum lexer_state_type {
|
enum lexer_state_type {
|
||||||
@@ -19,7 +20,7 @@ struct lexer_state {
|
|||||||
|
|
||||||
struct ivy_asm_lexer_symbol_node {
|
struct ivy_asm_lexer_symbol_node {
|
||||||
char s_char;
|
char s_char;
|
||||||
enum ivy_symbol s_id;
|
enum ivy_asm_symbol s_id;
|
||||||
|
|
||||||
b_queue_entry s_entry;
|
b_queue_entry s_entry;
|
||||||
b_queue s_children;
|
b_queue s_children;
|
||||||
|
|||||||
Reference in New Issue
Block a user