Re: [e-users] e16: better comment parsing in AclassConfigLineParse

2023-06-26 Thread Kim Woelders

On 2023-06-27 00:35, Dennis Nezic wrote:

On 26 Jun 19:53, Kim Woelders wrote:

On 2023-06-25 19:22, Dennis Nezic wrote:

Currently comments in bindings.cfg are parsed dumbly (but efficiently)
as the first occurrence of '#', even if it occurs in a pair of quotes.
Attached is a more intelligent way that handles such quotes.

"eesh exec" in a terminal, and the exec commands in the .menu files are
both able to handle this, I guess because the shell is doing that
parsing.

Eg.
eesh exec logger http://hello#world
eesh exec logger 'http://hello #world'


Hi Dennis,

Thanks for your input. I ended up doing this a bit differently and more
along the lines of what was done in similar situations elsewhere.
The primary difference is probably that the whitespace before a comment
should also be stripped.
Also, escapes(\) are not handled specially as they are not either in
similar cases elsewhere.


Cool! This does what I need (html #links), although it doesn't
properly handle nested quotes? - not sure if they should.

Eg.  command "argument with 'nested quote'" # a comment


Right, fixed now, I think.

Thanks :)

/Kim




___
enlightenment-users mailing list
enlightenment-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-users


Re: [e-users] e16: better comment parsing in AclassConfigLineParse

2023-06-26 Thread Dennis Nezic
On 26 Jun 19:53, Kim Woelders wrote:
> On 2023-06-25 19:22, Dennis Nezic wrote:
> > Currently comments in bindings.cfg are parsed dumbly (but efficiently)
> > as the first occurrence of '#', even if it occurs in a pair of quotes.
> > Attached is a more intelligent way that handles such quotes.
> > 
> > "eesh exec" in a terminal, and the exec commands in the .menu files are
> > both able to handle this, I guess because the shell is doing that
> > parsing.
> > 
> > Eg.
> > eesh exec logger http://hello#world
> > eesh exec logger 'http://hello #world'
> > 
> Hi Dennis,
> 
> Thanks for your input. I ended up doing this a bit differently and more 
> along the lines of what was done in similar situations elsewhere.
> The primary difference is probably that the whitespace before a comment 
> should also be stripped.
> Also, escapes(\) are not handled specially as they are not either in 
> similar cases elsewhere.

Cool! This does what I need (html #links), although it doesn't
properly handle nested quotes? - not sure if they should.

Eg.  command "argument with 'nested quote'" # a comment


___
enlightenment-users mailing list
enlightenment-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-users


Re: [e-users] e16: better comment parsing in AclassConfigLineParse

2023-06-26 Thread Kim Woelders

On 2023-06-25 19:22, Dennis Nezic wrote:

Currently comments in bindings.cfg are parsed dumbly (but efficiently)
as the first occurrence of '#', even if it occurs in a pair of quotes.
Attached is a more intelligent way that handles such quotes.

"eesh exec" in a terminal, and the exec commands in the .menu files are
both able to handle this, I guess because the shell is doing that
parsing.

Eg.
eesh exec logger http://hello#world
eesh exec logger 'http://hello #world'


Hi Dennis,

Thanks for your input. I ended up doing this a bit differently and more 
along the lines of what was done in similar situations elsewhere.
The primary difference is probably that the whitespace before a comment 
should also be stripped.
Also, escapes(\) are not handled specially as they are not either in 
similar cases elsewhere.


/Kim



___
enlightenment-users mailing list
enlightenment-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-users


Re: [e-users] e16: better comment parsing in AclassConfigLineParse

2023-06-26 Thread Dennis Nezic
Here's a slightly more robust inside of that for-loop, in case there are
escaped quotes outside a quoted pair (eg. quotes in filenames?), not
sure it's necessary to worry about these :p.

 if (*s3 == '\'' && (s3 == s || *(s3 - 1) != '\\')) { 
while (++s3https://lists.sourceforge.net/lists/listinfo/enlightenment-users


[e-users] e16: better comment parsing in AclassConfigLineParse

2023-06-25 Thread Dennis Nezic
Currently comments in bindings.cfg are parsed dumbly (but efficiently)
as the first occurrence of '#', even if it occurs in a pair of quotes.
Attached is a more intelligent way that handles such quotes.

"eesh exec" in a terminal, and the exec commands in the .menu files are
both able to handle this, I guess because the shell is doing that
parsing.

Eg.
eesh exec logger http://hello#world
eesh exec logger 'http://hello #world'
--- a/src/aclass.c  2023-06-25 12:32:51.0 -0400
+++ b/src/aclass.c  2023-06-25 12:47:03.0 -0400
@@ -692,12 +692,34 @@
ActionClass*ac = *pac;
Action *aa = *paa;
int len, len2;
-
-   len = strcspn(s, "#\r\n");
+   char   *s2, *s3;
+   intquoteclosed;
+  
+   len = strcspn(s, "\r\n");
if (len <= 0)
   return;
s[len] = '\0';
 
+   s2 = s - 1;
+   quoteclosed = 0;
+   while (!quoteclosed && (s2 = strchr(s2+1, '#'))) {
+   quoteclosed = 1;
+   for (s3=s; s3___
enlightenment-users mailing list
enlightenment-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-users