)' NB. return length
> 12
> um '(fff )(asdf)))'
> 12
>
> - Original Message -
> From: bill lam
> To: Programming forum
> Sent: Wednesday, December 28, 2016 8:11 PM
> Subject: Re: [Jprogramming] unmatched parenthesis
>
> just an idea (untested)
ramm...@jsoftware.com"
Sent: Thursday, December 29, 2016 8:02 AM
Subject: Re: [Jprogramming] unmatched parenthesis
better def actually, finds first extra ')' instead of last.
um =: ')('&$: : (#`(i:&0 + {: i.~ ] }.~ i:&0)`(_1 i.~ ])@.(*@{:)@:(+/\)@:(2 (]
*
27; via Programming
To: "programm...@jsoftware.com"
Sent: Thursday, December 29, 2016 7:57 AM
Subject: Re: [Jprogramming] unmatched parenthesis
The core idea,
+/\ ')(' (2 (] * >) 2 <:@* i.) '(((asdf))'
1 2 3 3 3 3 3 2 1
if total doesn't end in 0 its unmatc
* i.))
um '(fff )(asdf'
6
um '(fff )(asdf)' NB. return length
12
um '(fff )(asdf)))'
12
- Original Message -
From: bill lam
To: Programming forum
Sent: Wednesday, December 28, 2016 8:11 PM
Subject: Re: [Jprogramming] unmatched parenthesis
ju
gt; >> > It seems to me that this is in the spirit o J. Many uses of @ and
> other symbols indicate to me that the writer is "thinking" from left to
> right. If the coding of J is essentially from right to left your order
> feels right to me.
> >> >
> >
place (always thinking from the right).
I need to study more examples, but maybe there is some hope here
Linda
-Original Message-
From: Programming [mailto:programming-boun...@forums.jsoftware.com] On Behalf
Of Raul Miller
Sent: Tuesday, December 27, 2016 11:54 PM
To: Programming fo
to right.
>> > If the coding of J is essentially from right to left your order feels
>> > right to me.
>> >
>> > Linda
>> >
>> > -Original Message-
>> > From: Programming [mailto:programming-boun...@foru
t; If the coding of J is essentially from right to left your order feels right
> > to me.
> >
> > Linda
> >
> > -Original Message-
> > From: Programming [mailto:programming-boun...@forums.jsoftware.com] On
> > Behalf Of bill lam
> > Sent: Monday, Decemb
feels right to
> me.
>
> Linda
>
> -Original Message-
> From: Programming [mailto:programming-boun...@forums.jsoftware.com] On Behalf
> Of bill lam
> Sent: Monday, December 26, 2016 7:39 PM
> To: Programming forum
> Subject: Re: [Jprogramming] unmatched parenthes
rogramming [mailto:programming-boun...@forums.jsoftware.com] On Behalf
Of bill lam
Sent: Monday, December 26, 2016 7:39 PM
To: Programming forum
Subject: Re: [Jprogramming] unmatched parenthesis
'((()'
shouldn't the first unmatched at index 1 instead of 0? ie use i: instead of i.
for unmatched
Ah I see, the return 0 should be there, but you had missed an
else before it.
> > if (')'==c) {
> > if (0!=rparen++) return 0;
> > } else
> > return 0;
> > }
> > return 1;
everything works fine now. Thanks.
Вт, 27 дек 2016, Raul Miller написал(а):
> I do not kno
I do not know what values were returned for the "failed" cases, and I
should have that if I'm going to debug your c#. (Since I don't have c#
installed on this machine.)
That said, the return 0; in scriptclose belongs there: If there's any
characters on a line other a line other than whitespace or
My c# transliteration from your c code. Not sure if I had done
it correctly.
the return 0 inside scriptclose seemed shouldn't be there.
I tested it works with some success and some failures
aa) failed
aa)) ok
aa()) ok
single ")" (non-scriptclose) doesn't work
aa( failed
aa((
Ok, here's a translation to C. Some variable names changed. Lightly tested:
int scriptclose(char *line, unsigned int len) {
int rparen= 0;
for (unsigned int j= 0; j wrote:
> The firstunmatched verb needs to run only on visible
> portion of text and I think it should be fast enough, but
> i
The firstunmatched verb needs to run only on visible
portion of text and I think it should be fast enough, but
it requires some effort to translate the scan operator to
its equivalent in c or c#.
--
regards,
GPG key 1024D/4434BAB3 2008-08-24
g
There is no detail explicit rule for that, what I can find is
the following inside ~config/cfcolsav.ijs in J602 which I might
misread
00-19 system colors
20-39 class colors
40-59 keyword colors
0 bkgnd
1 text
2 selbkgnd
3 seltext
4 margin
5 mark (character d
With this design, there should be no need to refresh syntax
highlighting for lines which are off-screen.
Thanks,
--
Raul
On Mon, Dec 26, 2016 at 9:14 PM, bill lam wrote:
> The primary reason is efficiency. Every change or scrolling in text
> will trigger a highlighting routine to refresh. If
It seems to me that in ((() the first two parenthesis are unmatched
and the last two are matched.
Or, at least, I do not see why I would arbitrarily pick the middle
parenthesis of the three to be the first unmatched one.
Remember also, that in your original post in this thread you posed this exam
Also whitespace in j tokenizer includes TAB, so that
the first line can be revised to
> if. ')' -:&(-.&(' ',TAB)) y=. ,y do. #y return. end.
the ,y for fixing singleton atom to array.
Вт, 27 дек 2016, bill lam написал(а):
> '((()'
> shouldn't the first unmatched at index 1 instead of 0? ie us
The primary reason is efficiency. Every change or scrolling in text
will trigger a highlighting routine to refresh. If a file
contains several thousand of lines, and if it takes several
seconds to refresh, the editor would become un-usable.
Пн, 26 дек 2016, Devon McCormick написал(а):
> Is there a
Thanks, I got it now and I had never paid attention to it since
I seldom use jqt ide and did not enable syntax coloring on it.
Apparently the scheme used in jqt syntax coloring is faulty,
since if applies rules as independent and let the last rule to
overwrite the previous one.
Please feel free t
Yes, try
commentstart =. 'NB.' E. line
Henry Rich
On 12/26/2016 7:10 PM, bill lam wrote:
I can't get what you meant. Did you mean there are some bugs in qtide
syntax coloring?
On 27 Dec, 2016 3:25 am, "Henry Rich" wrote:
The parenthesis and comment delimiter in J have the part of speech
'((()'
shouldn't the first unmatched at index 1 instead of 0? ie use i: instead of
i. for unmatched (.
On 27 Dec, 2016 8:31 am, "Raul Miller" wrote:
Ah, good point - I was not properly handling the case where the first
unmatched parenthesis was the first character on the line.
Also, the clos
Ah, good point - I was not properly handling the case where the first
unmatched parenthesis was the first character on the line.
Also, the close script line is something of a special case, but it's
easy enough to check for:
With that fix and this change, I'd do something like this:
firstunmatche
I can't get what you meant. Did you mean there are some bugs in qtide
syntax coloring?
On 27 Dec, 2016 3:25 am, "Henry Rich" wrote:
The parenthesis and comment delimiter in J have the part of speech 'control
word'.
I didn't mean readable in the usual why-can't-anybody-write-comments-any-more
your verb seemed to find unmatched ) only, e.g. failed for
'(()' or '(()('
also a line of ) and whitespace belongs to class 'close definition' and
should not be flagged as mismatch.
On 27 Dec, 2016 2:42 am, "Raul Miller" wrote:
> I'm not sure what you mean by "containing control words" but code
Is there a particular reason to do this with regex? There are a couple of
essays about doing this in J like this one -
http://code.jsoftware.com/wiki/Essays/Parentheses_Matching - and my own
contribution:
http://code.jsoftware.com/wiki/User:Devon_McCormick/ArrayThinking/JConferenceTalk2014#Simplif
I meant 'punctuation' instead of 'control word' for ) and NB. .
Henry Rich
On 12/26/2016 2:25 PM, Henry Rich wrote:
The parenthesis and comment delimiter in J have the part of speech
'control word'.
I didn't mean readable in the usual
why-can't-anybody-write-comments-any-more sense, but as
The parenthesis and comment delimiter in J have the part of speech
'control word'.
I didn't mean readable in the usual
why-can't-anybody-write-comments-any-more sense, but as a reference to
the Qt IDE's habit of treating quoted control words as active, and
giving the wrong font to everything
I'm not sure what you mean by "containing control words" but code
readability issues are usually a call for better code.
For this, perhaps (warning: lightly tested code):
firstunmatched=:3 :0
q=. unquoted=. -.~:/\y=
c=. uncommented=. -. +./\ q * 'NB.' E. y
n=. parendepth=. +/\q*c*-/'()'
I don't think it is reasonable to treat ')' and 'NB.' as containing
control words. It makes the code very hard to read.
Showing the mismatched parenthesis is important enough that it might be
better to have it even with this deficiency, but it IS a deficiency and
should be treated as a bug to
I double checked with j602, it has no problem in high lighting
the unmatched )( in
a '+' ((mno - rst) % b NB. )unmatched paren
^
a '+' ((mno - rst) % b ')' NB. )unmatched paren
^
and
'(' (=:))
^
But this is matched and is correct
a '+' ((mno - rst) % b ')') NB. )unmatched par
w it helps you with J, and it is possibly overkill for
> whatever you are doing.
>
>
>
> On Mon, 12/26/16, bill lam wrote:
>
> Subject: Re: [Jprogramming] unmatched parenthesis
> To: programm...@jsoftware.com
> Date: Mon
> Note: I only bring this up since you seem to be working in .NET, although
> I am not sure how it helps you with J, and it is possibly overkill for
> whatever you are doing.
>
>
>
> On Mon, 12/26/16, bill lam wrote:
>
> Subjec
s possibly overkill for whatever you
are doing.
On Mon, 12/26/16, bill lam wrote:
Subject: Re: [Jprogramming] unmatched parenthesis
To: programm...@jsoftware.com
Date: Monday, December 26, 2016, 1:50 PM
I found this page
https://msdn.microsoft.com/en-us/lib
I found this page
https://msdn.microsoft.com/en-us/library/bs2twtah.aspx
c# regex has an extension called balanced group. But I still
cannot find how to match unbalanced group.
Вс, 25 дек 2016, Raul Miller написал(а):
> For that case, I'd code it in J, first, so that I could be sure it
> works, a
For that case, I'd code it in J, first, so that I could be sure it
works, and then translate that implementation to C#.
I think regex is a red herring here, because (a) regular expressions
cannot handle parenthesis balancing by themselves, and (b) the regex
implementation which J uses does not hav
In J602 windows front-end, it can high-light the unbalanced
parenthesis, the example was taken from config/colorsmp.ijs
using the JSample scheme.
I think it should be efficient and not coded in J.
An implementation in c/c# with regex would be appreciated.
Вс, 25 дек 2016, Raul Miller написал(а):
Formally speaking, no, not using pure regular expressions by themselves.
That said, it is possible to write a program which uses regular
expressions and a stack-like data structure to parse balanced
parenthesis.
That said, for this problem, something based on +/\-/'()'=/y would
probably be more s
Season's Greetings!
Is it possible to use regex to find the first index
unmatched )(
eg. for the line
a + ((mno - rst) % b NB. unmatched paren
^
01234
--
regards,
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --re
40 matches
Mail list logo