文章标题
来源:互联网 发布:c语言判断质数算法 编辑:程序博客网 时间:2024/06/11 02:56
看到网上各种转载修改源码使lua支持中文的,结果试了下发现测试出来有问题,如:
function 为而的() end
stdin:1: ‘(’ expected near ‘)’
这里就会报错,只好改下,就没问题了,如下改后的源码(改动之处已标明,lua5.1/lua5.2/lua5.3均支持)。
#pragma once#include <ctype.h>//////////////////////////////////////////////////////////////////////////////这是中文函数名添加的函数///////////////////////////////////////////////////////////////////////////*开始添加支持中英文变量名*//*因为LS->current是int类型!*/#define USE_CHINESE_NAME #ifdef USE_CHINESE_NAME #define isChineseCode(charint) (charint >= 0x80) //<<<<<<<<<<<<<<<<<< 第一处#define readxxname(ls) readChinesename(ls) void readChinesename(LexState *ls){ do { if (isChineseCode(ls->current)) { save_and_next(ls); //if(ls->current!='(') if(isChineseCode(ls->current)) //<<<<<<<<<<<<<<<<<<< 第二处 { save_and_next(ls); //处理了一个中文字符 } } else { //if(ls->current!='(') { save_and_next(ls); //处理英文字符或者下划线 } } } while (isChineseCode(ls->current) || ls->current == '_' || isalnum(ls->current));}#else #define isChineseCode(charint) 0 #define readxxname(ls) readname(ls) void readname(LexState *ls){ do { save_and_next(ls); //处理英文字符或者下划线 } while (isChineseCode(ls->current) || ls->current == '_' || isalnum(ls->current));}#endif //////////////////////////////////////////////////////////////////////////////以上是中文变量名定义函数////////////////////////////////////////////////////////////////////////////
2016-2-7 新
发现lua5.1.5的mingw64版在windows64 cmd里有问题,有字符缓冲错位的问题,看来以后可以看看什么原因。
0 0
- 文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题 文章标题 文章标题 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- DNS,ARP,秘钥和数字签名.
- 使用基于Http的消息代替WebService的数据交互
- RedHat安装jdk
- 一些奇淫巧技
- 在Qt for Android中添加.a或so库文件
- 文章标题
- 安卓界面延时跳转
- C变异测试 mutation testing 工具 Milu
- Mysql表的操作
- 51Nod 1050 循环数组最大子段和(dp)
- Android中常用颜色值
- C语言的STL 库
- Mac os x 系统开启自带php环境
- 51Nod 1065 最小正子段和(归并 贪心,好题)