Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
itdan3344
stb
提交
42ee0424
S
stb
项目概览
itdan3344
/
stb
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
stb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
42ee0424
编写于
6月 15, 2014
作者:
S
Sean Barrett
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Re-add lost fix to 'get_location' function as reported by Andreas Fredriksson.
上级
48234a16
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
4 addition
and
3 deletion
+4
-3
stb_c_lexer.h
stb_c_lexer.h
+4
-3
未找到文件。
stb_c_lexer.h
浏览文件 @
42ee0424
// stb_c_lexer.h - v0.0
4
- public domain Sean Barrett 2013
// stb_c_lexer.h - v0.0
5
- public domain Sean Barrett 2013
// lexer for making little C-like languages with recursive-descent parsers
// lexer for making little C-like languages with recursive-descent parsers
//
//
// This file provides both the interface and the implementation.
// This file provides both the interface and the implementation.
...
@@ -10,6 +10,8 @@
...
@@ -10,6 +10,8 @@
// suffixes on integer constants are not handled (you can override this).
// suffixes on integer constants are not handled (you can override this).
//
//
// History:
// History:
// 0.05
// refixed get_location because github version had lost the fix
// 0.04
// 0.04
// fix octal parsing bug
// fix octal parsing bug
// 0.03
// 0.03
...
@@ -22,7 +24,6 @@
...
@@ -22,7 +24,6 @@
// Status:
// Status:
// - haven't tested compiling as C++
// - haven't tested compiling as C++
// - haven't tested the float parsing path
// - haven't tested the float parsing path
// - maybe tested "get_location" function (used for error reporting) in 0.03
// - haven't tested the non-default-config paths (e.g. non-stdlib)
// - haven't tested the non-default-config paths (e.g. non-stdlib)
// - only tested default-config paths by eyeballing output of self-parse
// - only tested default-config paths by eyeballing output of self-parse
//
//
...
@@ -294,7 +295,7 @@ void stb_c_lexer_get_location(const stb_lexer *lexer, const char *where, stb_lex
...
@@ -294,7 +295,7 @@ void stb_c_lexer_get_location(const stb_lexer *lexer, const char *where, stb_lex
char
*
p
=
lexer
->
input_stream
;
char
*
p
=
lexer
->
input_stream
;
int
line_number
=
1
;
int
line_number
=
1
;
int
char_offset
=
0
;
int
char_offset
=
0
;
while
(
*
p
)
{
while
(
*
p
&&
p
<
where
)
{
if
(
*
p
==
'\n'
||
*
p
==
'\r'
)
{
if
(
*
p
==
'\n'
||
*
p
==
'\r'
)
{
p
+=
(
p
[
0
]
+
p
[
1
]
==
'\r'
+
'\n'
?
2
:
1
);
// skip newline
p
+=
(
p
[
0
]
+
p
[
1
]
==
'\r'
+
'\n'
?
2
:
1
);
// skip newline
line_number
+=
1
;
line_number
+=
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录