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

Incorrect handling of semicolon after command syntax #7

Closed
rlivings39 opened this issue Aug 30, 2019 · 5 comments · Fixed by #37
Closed

Incorrect handling of semicolon after command syntax #7

rlivings39 opened this issue Aug 30, 2019 · 5 comments · Fixed by #37

Comments

@rlivings39
Copy link
Member

From thedavidprice/language-matlab-octave#19

Consider he code:

x = 1;
someCommand arg1; x = 1;

should treat x = 1; in the second line as typical code not as a string as part of the command. Notice that the 1 is not highlighted in the second line.

The difference is more pronounced in Atom with the language-matlab-octave extension:
atomCommandSemicolon

@ghost
Copy link

ghost commented Apr 25, 2021

<key>command_dual</key>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>string.interpolated.matlab</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>variable.other.command.matlab</string>
</dict>
<key>28</key>
<dict>
<key>name</key>
<string>comment.line.percentage.matlab</string>
</dict>
</dict>
<key>comment</key>
<string> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1516 17 18 19 20 21 22 23 24 25 26 27 28</string>
<key>match</key>
<string>^\s*((?# A&gt; )([b-df-hk-moq-zA-HJ-MO-Z]\w*|a|an|a([A-Za-mo-z0-9_]\w*|n[A-Za-rt-z0-9_]\w*|ns\w+)|e|ep|e([A-Za-oq-z0-9_]\w*|p[A-Za-rt-z0-9_]\w*|ps\w+)|in|i([A-Za-mo-z0-9_]\w*|n[A-Za-eg-z0-9_]\w*|nf\w+)|I|In|I([A-Za-mo-z0-9_]\w*|n[A-Za-eg-z0-9_]\w*|nf\w+)|j\w+|N|Na|N([A-Zb-z0-9_]\w*|a[A-MO-Za-z0-9_]\w*|aN\w+)|n|na|nar|narg|nargi|nargo|nargou|n([A-Zb-z0-9_]\w*|a([A-Za-mo-qs-z0-9_]\w*|n\w+|r([A-Za-fh-z0-9_]\w*|g([A-Za-hj-nq-z0-9_]\w*|i([A-Za-mo-z0-9_]\w*|n\w+)|o([A-Za-tv-z0-9_]\w*|u([A-Za-su-z]\w*|t\w+))))))|p|p[A-Za-hj-z0-9_]\w*|pi\w+)(?# &lt;A )\s+(((?# B&gt; )([^\s;,%()=.{&amp;|~&lt;&gt;:+\-*/\\@^'"]|(?=')|(?="))(?# &lt;B )|(?# C&gt; )(\.\^|\.\*|\./|\.\\|\.'|\.\(|&amp;&amp;|==|\|\||&amp;(?=[^&amp;])|\|(?=[^\|])|~=|&lt;=|&gt;=|~(?!=)|&lt;(?!=)|&gt;(?!=)|:|\+|-|\*|/|\\|@|\^)(?# &lt;C )(?# D&gt; )([^\s]|\s*(?=%)|\s+$|\s+(,|;|\)|}|\]|&amp;|\||&lt;|&gt;|=|:|\*|/|\\|\^|@|(\.[^\d.]|\.\.[^.])))(?# &lt;D )|(?# E&gt; )(\.[^^*/\\'(\sA-Za-z])(?# &lt;E ))(?# F&gt; )([^%]|'[^']*'|"[^"]*")*(?# &lt;F )|(?# X&gt; )(\.(?=\s)|\.[A-Za-z]|(?={))(?# &lt;X )(?# Y&gt; )([^(=\'"%]|==|'[^']*'|"[^"]*"|\(|\([^)%]*\)|\[|\[[^\]%]*\]|{|{[^}%]*})*(\.\.\.[^%]*)?((?=%)|$)(?# &lt;Y )))(%.*)?$</string>
</dict>

Looking at the help page, this seems overcomplicated. Dual command syntax is simple.. there's a keyword.other/support.function word and a char vector option at the end (terminated by [\n;%]). A check for missing = or ( after the "word" is the only thing needed.

I'll see what comes of hacking at it

@ghost
Copy link

ghost commented Apr 26, 2021

Bugfix @ PR #37.

@ghost
Copy link

ghost commented May 23, 2021

Could you ping your colleague about the PR on Slack? I've corrected this issue and added enhancements: #37 (comment)

@ghost
Copy link

ghost commented Jun 11, 2021

Resolved by #37. This issue needs closing

@dklilley
Copy link
Member

dklilley commented Aug 3, 2021

Closing - resolved by #37

@dklilley dklilley closed this as completed Aug 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants