Re: Interest in adding a tree-sitter mode for Slang?

Philip Kaludercic <[email protected]>
Newsgroups gmane.emacs.devel
Message-ID <[email protected]>
Stefan Monnier <[email protected]> writes:

>> +  :safe 'natnump)
>            ^
>            #

Oops!

>>  ;;; Syntax Table (mostly derived from C)
>>  (defvar slang-ts-mode--syntax-table
>> -  (let ((table (make-syntax-table)))
>> -    (modify-syntax-entry ?+   "."      table)
>> -    (modify-syntax-entry ?-   "."      table)
>> -    (modify-syntax-entry ?=   "."      table)
>> -    (modify-syntax-entry ?%   "."      table)
>> -    (modify-syntax-entry ?&   "."      table)
>> -    (modify-syntax-entry ?|   "."      table)
>> -    (modify-syntax-entry ?^   "."      table)
>> -    (modify-syntax-entry ?!   "."      table)
>> -    (modify-syntax-entry ?@   "."      table)
>> -    (modify-syntax-entry ?~   "."      table)
>> -    (modify-syntax-entry ?<   "."      table)
>> -    (modify-syntax-entry ?>   "."      table)
>> -    (modify-syntax-entry ?/   ". 124b" table)
>> -    (modify-syntax-entry ?*   ". 23"   table)
>> -    (modify-syntax-entry ?\n  "> b"    table)
>> -    (modify-syntax-entry ?\^m "> b"    table)
>> -    (modify-syntax-entry ?\` "." table)
>> -    (modify-syntax-entry ?$  "." table)
>> -    table)
>> +  (with-syntax-table (make-syntax-table)
>> +    (modify-syntax-entry ?+   ".")
>> +    (modify-syntax-entry ?-   ".")
>> +    (modify-syntax-entry ?=   ".")
>> +    (modify-syntax-entry ?%   ".")
>> +    (modify-syntax-entry ?&   ".")
>> +    (modify-syntax-entry ?|   ".")
>> +    (modify-syntax-entry ?^   ".")
>> +    (modify-syntax-entry ?!   ".")
>> +    (modify-syntax-entry ?@   ".")
>> +    (modify-syntax-entry ?~   ".")
>> +    (modify-syntax-entry ?<   ".")
>> +    (modify-syntax-entry ?>   ".")
>> +    (modify-syntax-entry ?/   ". 124b")
>> +    (modify-syntax-entry ?*   ". 23")
>> +    (modify-syntax-entry ?\n  "> b")
>> +    (modify-syntax-entry ?\^m "> b")
>> +    (modify-syntax-entry ?\` ".")
>> +    (modify-syntax-entry ?$  ".")
>> +    (syntax-table))
>>    "Syntax table for `slang-ts-mode'.")
>
> That's an odd suggestion.  Most code out there uses the
> `(let ... table)` style rather than `with-syntax-table`.
>
> `with-syntax-table` is a somewhat problematic feature
> in general (e.g. any `syntax-ppss` that happens within
> a `with-syntax-table` has to be treated specially, etc...), so
> we should keep it for those cases where it's really needed.

My idea was mainly to avoid having to specify the optional SYNTAX-TABLE
entry in every line, since it can default to the current syntax table,
but if you think this is problematic I'd also gladly retract my
suggestions.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.