[Gambas-user] highlight.analyze error after label
Brian G
brian at westwoodsvcs.com
Thu Nov 9 21:51:57 CET 2023
When a keyword follows a label it is identified as a symbol, not as a
keyword?
Not sure if this is a feature or a bug!
The following script shows this output type and text
Types with Label and keyword on same line "l000345: print \"hello world\""
22 l000345:
14 print
16 "hello world"
Types without Label and keyword "Print \"hello world\""
11 Print
16 "hello world"
Types without Label with comment " l1234: ' this is a
comment"
22 l1234:
9 ' this is a comment
---------------- Script --------------------------------
#!/usr/bin/env gbs3
use "gb.eval","gb.highlight"
Public Sub Main()
Dim source As String[] = ["l000345: print \"hello world\"",
"Print \"hello world\"", " l1234: ' this is a comment"]
analyze(source[0], "Types with Label and keyword on same line")
analyze(source[1], "Types without Label and keyword")
analyze(source[2], "Types without Label with comment")
End
Sub analyze(text As String, comment As String)
Dim vtype As Integer
Dim analyzed As String[] = highlight.analyze(text, True)
Print comment;; Quote(Highlight.TextAfter)
For vtype = 0 To Highlight.Types.max
Print Highlight.Types[vtype], analyzed[vtype]
Next
Print
End
--
~~~~ Brian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0x78BFB26402F48419.asc
Type: application/pgp-keys
Size: 2428 bytes
Desc: OpenPGP public key
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20231109/0d46bc77/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 665 bytes
Desc: OpenPGP digital signature
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20231109/0d46bc77/attachment.sig>
More information about the User
mailing list