-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
多行宏的正则 记录基本单元 #8
Comments
完整正则备份
|
作用:匹配使用单引号的字符串 |
公开正则库:https://regex101.com/r/T2wUDF/1 说明备份:用于解析bkengine的宏代码 |
处理多行宏词法分析的步骤原则 (基于正则)
|
预处理数组流程 string.replace()
变成这种形式以后
使用下面的方法取数组的值
|
最终成品 (最后一步)
|
@ktabata |
@2439905184 |
但是bkengine的多行宏语法格式存在歧义lexer可以解决这个问题吗? [sprite index=1 rect=[0,0,0,0]] [addto index=1 target=basic_layer] '[ ]'can bu used as keyword of array '[sprite' is the macro format , word must behind '[' and cant have space. |
You need a parser. Parser can parse multiple statements. You can use lexer/parser generator like: But before using it, you have to be familiar with how lexer/parser works. |
匹配长度为4的int数组
意思是匹配=号右边的这些字符:" [数字,数字,数字,数字] " 且中间没有空格
测试用例
The text was updated successfully, but these errors were encountered: