When writing some new SQL queries, I was wondering, would there be a downside to allowing direct newlines in strings?
I.e. sample code:
mixed r = db->big_typed_query(" SELECT invno FROM mutation mu WHERE mu.mutid = 12 ");
would then just work. And if that is not desirable, any other suggestions which do not involve ugliness like:
mixed r = db->big_typed_query("" "SELECT invno " " FROM mutation mu " " WHERE mu.mutid = 12 " "");
or
mixed r = db->big_typed_query(" \ SELECT invno \ FROM mutation mu \ WHERE mu.mutid = 12 \ ");
When writing some new SQL queries, I was wondering, would there be a downside to allowing direct newlines in strings?
I.e. sample code:
mixed r = db->big_typed_query(" SELECT invno FROM mutation mu WHERE mu.mutid = 12 ");
would then just work.
You are aware of the #"..." syntax?
/grubba
Henrik Grubbstr?m (Lysator) @ Pike (-) developers forum wrote:
When writing some new SQL queries, I was wondering, would there be a downside to allowing direct newlines in strings?
You are aware of the #"..." syntax?
No. But yes, that seems to solve it. That's a pike-ism, is it? Or are there C/cpp compilers that support that too?
Vim syntax colouring goes berzerk, though ;-).
On Mon, Jan 8, 2018 at 4:17 PM, Stephen R. van den Berg srb@cuci.nl wrote:
Vim syntax colouring goes berzerk, though ;-).
I have had some success with this one: https://github.com/vim-scripts/pike.vim/blob/master/syntax/pike.vim
Tobi
Tobias S. Josefowitz wrote:
On Mon, Jan 8, 2018 at 4:17 PM, Stephen R. van den Berg srb@cuci.nl wrote:
Vim syntax colouring goes berzerk, though ;-).
I have had some success with this one: https://github.com/vim-scripts/pike.vim/blob/master/syntax/pike.vim
Yes. And then I see a lot of things it could do better, like: - Highlighting the index values in declared mappings. - Highlighting the embedded binding parameters in SQL queries. - Using SQL-syntax highlighting in multiline strings. - Working missing parenthesis errors for *all* supported Pike paren types (which includes arrays, mappings, multisets, advisory casts, ranges, indexing, embedded lambdas). - Highlighting MutexKey operations. - Showing grayed out #if 0 or #if 1 #else sections. - Supporting cycling through all coherent preprocessor conditionals.
So I took the current c.vim, and then repaired and transmogrified it into a pike.vim which does all of the above and more (it supports all pike 8.1 constructs I could find). File is attached for the vim users on this list; I've submitted it to Vim upstream as well.
Stephen R. van den Berg wrote:
So I took the current c.vim, and then repaired and transmogrified it into a pike.vim which does all of the above and more (it supports all pike 8.1 constructs I could find).
Added an autodoc.vim as well, so that it colours embedded Autodoc *and* embedded SQL now. Also, small bugfixes since the last version I posted here. Please look at: https://vim.sourceforge.io/scripts/script_search_results.php?keywords=pike&a...
I'm not sure what needs to be done to get both files included in the Vim standard distribution (my my pike.vim should supersede Paul Miller's).
Stephen R. van den Berg wrote:
https://vim.sourceforge.io/scripts/script_search_results.php?keywords=pike&a...
The file has two other dependencies: sqloracle.vim and matchit. Both are included in standard Vim 8.0 distributions. I added some more installation instructions on the pike.vim package page. If either of those other dependencies is not available, you can simply comment out the corresponding two lines referencing them in pike.vim; you then lose embedded SQL highlighting and if/then/else/elif/endif cycling, all the rest still works fine.
Stephen R. van den Berg wrote:
Stephen R. van den Berg wrote:
https://vim.sourceforge.io/scripts/script_search_results.php?keywords=pike&a...
Uploaded version 2.2 of pike.vim and autodoc.vim. The colouring of preprocessor directive has more detail now.
Also, both files have been submitted to the github Vim repository (and thus should end up in your favourite repository eventually).
Stephen R. van den Berg wrote:
Stephen R. van den Berg wrote:
Stephen R. van den Berg wrote:
https://vim.sourceforge.io/scripts/script_search_results.php?keywords=pike&a...
Uploaded version 2.2 of pike.vim and autodoc.vim. The colouring of preprocessor directive has more detail now.
There is an autodoc.vim v2.2.1 now (sorry, hacking vim syntax files is more of a black art than anything else), it now supports error highlighting and a fixed set of keywords (some where missing, some where missorted).
Incidentally the docs for Autodoc seem to be incomplete; it fails to document @global ?
AFAICS these were the last iterations of these syntax colouring files (famous last words). I know for a fact that I'm fed up with them for the moment.
Stephen R. van den Berg wrote:
[...]
Incidentally the docs for Autodoc seem to be incomplete; it fails to document @global ?
It's probably intentional; from Tools.AutoDoc.DocParser:
parseError("The @global keyword is obsolete. " "Use @belongs predef:: instead.");
/grubba
And, finally, to keep the flow going:
https://vim.sourceforge.io/scripts/script.php?script_id=5645
As of now, there is a cmod.vim as well (includes the Autodoc highlighting as well).
Stephen R. van den Berg wrote:
https://vim.sourceforge.io/scripts/script.php?script_id=5645
Added a boatload of identifiers which are used in cmod files.
Because sourceforge has issues, you can retrieve the latest set of pike.vim/cmod.vim/autodoc.vim files directly from the ongoing pull request that is pending on the Vim repository:
https://github.com/vim/vim/pull/2558
This bumps the version to 2.4 for all of them. Notable changes: pike.vim: - Increased visibility of userlabels and case labels. - Made the embedded SQL parser smarter; it now only switches to SQL if the string starts with a standard SQL statement.
Stephen R. van den Berg wrote:
pike.vim/cmod.vim/autodoc.vim files directly from the https://github.com/vim/vim/pull/2558
This bumps the version to 2.5 for all of them. Notable changes: pike.vim: - Speedup, smaller memory footprint. - Robuster against Vim matching anomalies. - Consistent colouring even when scrolling up line-by-line. - Made the embedded SQL parser smarter; it now only switches to SQL if the string starts with a standard SQL statement (matching improved).
Given the changes in the language it is probably not prudent to list .lpc and .ulpc as suffixes (sufficies?) anymore.
Martin Nilsson (Coppermist) @ Pike (-) developers forum wrote:
Given the changes in the language it is probably not prudent to list .lpc and .ulpc as suffixes (sufficies?) anymore.
Good point. Fixed.
Suffices (according to Latin).
Stephen R. van den Berg wrote:
Stephen R. van den Berg wrote:
pike.vim/cmod.vim/autodoc.vim files directly from the https://github.com/vim/vim/pull/2558
This bumps the version to 2.6 for all of them. Notable changes: pike.vim: - Boosted paren mismatch checks (it works a lot better than in c.vim now). - Offer several sync methods to resync parsing with the file. - Finetuned parsing and display of break/continue and static case labels.
autodoc.vim: - Different colour for directives that are of the @xyz @endxyz type.
c.vim: - Embedded Autodoc support. Add to your .vimrc: let b:c_autdoc=1 to enable it.
pike.vim/cmod.vim/autodoc.vim files directly from the https://github.com/vim/vim/pull/2558
Version 2.9 of all files made it into Vim proper 8.0.1438 and onward yesterday.
pike-devel@lists.lysator.liu.se