Skip to content
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

[Bug] 在错误的时机对Latex进行解析,导致$xxx$的$符号意外被吞 #5955

Open
Alumopper opened this issue Dec 20, 2024 · 13 comments
Labels
bug Something isn't working

Comments

@Alumopper
Copy link

Alumopper commented Dec 20, 2024

📦 部署方式

官方安装包

📌 软件版本

2.15.8

💻 系统环境

Windows

📌 系统版本

Windows 11 专业版 23H2 22635.4655 Windows 功能体验包 1000.22700.1065.0

🌐 浏览器

Edge

📌 浏览器版本

132.0.2957.55 (正式版本) stable应用,beta频道 (64 位)

🐛 问题描述

当我尝试发送以下内容:

OrgCommandText
   :  ~('$'|[\r\n])+ | '$'
   ;

OrgCommandExprStart
   :   '${' -> pushMode(DEFAULT_MODE)
  ;

OrgCommandEnd
   :   ('\r\n' | '\n') -> popMode
   ;

把这个转换为jflex

的时候,猜测由于$$会被识别为内联Latex表达式,所以被吞了,发送的时候变成了

OrgCommandText
   :  ~('|[\r\n])+ 
  | '
   ;

OrgCommandExprStart
  :   '${' -> pushMode(DEFAULT_MODE)
   ;

OrgCommandEnd
   :   ('\r\n' | '\n') -> popMode
   ;

把这个转换为jflex

同时AI的回答也因为输入的错误导致了错误的结果。

📷 复现步骤

发送如下内容

'$'test'$'

发现发送以后变成了

'test'

🚦 期望结果

成功发送上述内容,包含$符号

📝 补充信息

  • 使用\$转义也是不可行的
  • 只要是$',都会被吞,如果只发送一个$',那么会发送一个空白信息
@Alumopper Alumopper added the bug Something isn't working label Dec 20, 2024
@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Title: [Bug] Latex is parsed at the wrong time, causing the $ symbol of $xxx$ to be accidentally swallowed

📦 Deployment method

Official installation package

📌 Software version

2.15.8

💻 System environment

Windows

📌 System version

Windows 11 Pro 23H2 22635.4655 Windows Feature Experience Pack 1000.22700.1065.0

🌐 Browser

Edge

📌 Browser version

132.0.2957.55 (official version) stable application, beta channel (64-bit)

🐛 Problem description

When I try to send the following:

OrgCommandText
: ~('$'|[\r\n])+ | '$'
;

OrgCommandExprStart
: '${' -> pushMode(DEFAULT_MODE)
;

OrgCommandEnd
: ('\r\n' | '\n') -> popMode
;

Convert this to jflex
When, I guessed that $$ would be recognized as an inline Latex expression, so it was swallowed, and when sent, it became

OrgCommandText
: ~('|[\r\n])+
| '
;

OrgCommandExprStart
: '${' -> pushMode(DEFAULT_MODE)
;

OrgCommandEnd
: ('\r\n' | '\n') -> popMode
;

Convert this to jflex

At the same time, the AI's answers also resulted in incorrect results due to input errors.

📷 Steps to reproduce

Send the following content

'$'test'$'

I found that after sending it, it became

'test'

🚦 Expected results

The above content was successfully sent, including the $ symbol

📝 Supplementary information

No response

@QAbot-zh
Copy link

手动套进格式块里吧,这样就不会影响 $ 的解析了,要靠 if else 处理掉任意情况下的 $ 解析太难了

image

Clip_2024-12-20_16-38-05

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Manually insert it into the format block, so that it will not affect the parsing of $. It is too difficult to rely on if else to handle the parsing of $ in any situation.

image

Clip_2024-12-20_16-38-05

@Alumopper
Copy link
Author

比较奇怪的就是这里了,我在代码块里面的东西也会被吞。之前问题描述里面这个就是放在代码块里面的(不是为了格式美观,是原封不动的文本信息),按理来说至少代码格式块里面的不应该被吞

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


The strange thing is here, the things I put in the code block will also be swallowed. In the previous problem description, this was placed in the code block (not for the sake of beautiful format, but as intact text information). Logically speaking, at least the code format block should not be swallowed.

@QAbot-zh
Copy link

方便提供下提问的 prompt 我测试下吗

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


It is convenient to provide a prompt for asking questions. Can I test it?

@Alumopper
Copy link
Author

'$'test'$'

用代码块包裹这个语句就能触发了

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


'$'test'$'

Wrap this statement with a code block to trigger it

@QAbot-zh
Copy link

怎么理解?
image

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


How to understand?
image

@Alumopper
Copy link
Author

Alumopper commented Dec 20, 2024

发送以后就被吞了
image

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


It was swallowed after being sent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants