mIRC Homepage

Help Documenting syntax

Posted By: FroggieDaFrog

Help Documenting syntax - 24/12/19 03:50 PM

I'm working on a text-mate style syntax highlighter(VSCode, VSStudio, Atom, Sublime, etc) and would greatly appreciate crowd sourcing the syntax documentation.

Currently what I have documented is:
- Block Comment
- Menu

Whats currently needed:
- single/line comments and how they behave within a block
- Pipe(|) behavior under various conditions
- event syntax, including but not limited to all prefixing, event names, and parameters
- alias definitions
Posted By: SykO

Re: Help Documenting syntax - 24/12/19 07:21 PM

Here is a small test from the syntax highlighter I was working on:

Code
alias singleLineCommentTest {
  ; comment
  echo -s test 1
  ; comment | echo -s test 2
  ; comment | echo -s test 3 | ;comment |
  { ; comment } | echo -s test 4
  { ; comment | } | echo -s test 5
  { ; comment | echo -s test 6 } | ; comment | echo -s test 7
  { echo -s test 8 | ; comment } | echo -s test 9
  { echo -s test 10 | ; comment | } | echo -s test 11
  echo -s test 12 | ; comment | echo -s test 13
  echo -s test 14 | 
  echo -s test 15 |
  ; comment | { echo -s test 16 }
}


Calling the command will output:

Code
test 1
test 4
test 8
test 10
test 12
test 13
test 14
test 15 |


What I got for my test:

1. If a line starts with a comment, the line is treated as a comment line.
2. If a comment is between a line, with the help of pipes, then only said part of the line is treated as a comment.

My second conclusion does have an exception, shown by:

Code
{ echo -s test 8 | ; comment } | echo -s test 9


outputs test 8, but not test 9

where as:

Code
{ ; comment } | echo -s test 4


outputs test 4

Hope this helps a bit, I will edit this reply as soon as I do more test and/or find out extra information.
Posted By: FroggieDaFrog

Re: Help Documenting syntax - 24/12/19 07:29 PM

Thanks!

Just to be safe, each test should be seperete from all others to avoid block-interaction behaviors.

Test #14 and #15 are related to how pipes at the end of a block or line are treated, I believe the same is true for all tests with 'empty commands'
Code
{ ... | }
© 2020 mIRC Discussion Forums