소스 검색

Add hexadecimal, binary and unsigned integer literals

pull/1/head
Max Brunsfeld 10 년 전
부모
커밋
8190b6ea7f
3개의 변경된 파일3173개의 추가작업 그리고 2966개의 파일을 삭제
  1. +6
    -1
      grammar.coffee
  2. +15
    -0
      grammar_test/expressions.txt
  3. +3152
    -2965
      src/parser.c

+ 6
- 1
grammar.coffee 파일 보기

@ -435,7 +435,12 @@ module.exports = grammar
@_expression,
@initializer_list)
number_literal: -> /\d+(\.\d+)?/
number_literal: -> token(choice(
/\d+(\.\d+)?/,
/\d+u/,
seq("0x", /[0-9a-fA-f]+/),
seq("0b", /[01]+/),
))
char_literal: -> token(seq(
"'",

+ 15
- 0
grammar_test/expressions.txt 파일 보기

@ -1,3 +1,18 @@
============================================
Number literals
============================================
int a = 0xAC00;
int b = 0.123;
int c = 0b1010001;
---
(translation_unit
(declaration (identifier) (init_declarator (identifier) (number_literal)))
(declaration (identifier) (init_declarator (identifier) (number_literal)))
(declaration (identifier) (init_declarator (identifier) (number_literal))))
============================================
Identifiers
============================================

+ 3152
- 2965
src/parser.c
파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
파일 보기


불러오는 중...
취소
저장