Skip to content

Lexing inside comments #130

@Hels15

Description

@Hels15

We lex down some stuff inside comments that we should not:

/*
# 32-bit float operations
c_float_f32_add: f32 = 32.3 + 5.5;
c_float_f32_sub: f32 = 32.3 - 3.3;
c_float_f32_mul: f32 = 32.3 * 2.0;
c_float_f32_div: f32 = 32.3 / 2.0;
c_float_f32_paren: f32 = (32.3 + 2.2) * 3.1 - 1.1;

printf(c_float_f32_add, "\n"); # 37.8
printf(c_float_f32_sub, "\n"); # 29.0
printf(c_float_f32_mul, "\n"); # 64.6
printf(c_float_f32_div, "\n"); # 16.15
printf(c_float_f32_paren, "\n"); # 108.69
*/

# 64-bit integer operations
b_int_i64_add: int64 = 45 + 5;
b_int_i64_sub: int64 = 45 - 3;
b_int_i64_mul: int64 = 45 * 2;
b_int_i64_div: int64 = 45 / 2;
b_int_i64_paren: int64 = (45 + 2) * 3 - 1;

printf(b_int_i64_add, "\n"); # 50
printf(b_int_i64_sub, "\n"); # 42
printf(b_int_i64_mul, "\n"); # 90
printf(b_int_i64_div, "\n"); # 22.5
printf(b_int_i64_paren, "\n"); # 140
Value: *
Kind: DONSUS_STAR
Length: 1
Line: 1

Value: 2.0
Kind: DONSUS_FLOAT
Length: 0
Line: 1

Value: ;
Kind: DONSUS_SEMICOLON
Length: 1
Line: 1

Value: 
Kind: DONSUS_NEWLINE
Length: 1
Line: 2

Value: c_float_f32_div
Kind: DONSUS_NAME
Length: 15
Line: 2

Value: :
Kind: DONSUS_COLO
Length: 1
Line: 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions