unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Rosen Diankov" <rdiankov@cs.cmu.edu>
To: "Chong Yidong" <cyd@stupidchicken.com>
Cc: lefevrol@yahoo.com, Kurt Hornik <Kurt.Hornik@wu-wien.ac.at>,
	703@emacsbugs.donarmstrong.com
Subject: bug#703: Octave comments in emacs
Date: Thu, 21 Aug 2008 14:26:55 -0400	[thread overview]
Message-ID: <103101d70808211126v513f4884i3c2759e0e2eae075@mail.gmail.com> (raw)
In-Reply-To: <87k5eawef3.fsf@cyd.mit.edu>

> Maybe we could use a rough heuristic to handle most of the cases.  A '
> character that occurs before "[=(] *" is probably the beginning of a
> single quoted string, not a transpose operator.  WDYT?
I can think of a lot of cases where this would break.

The proper way of doing it is to tokenize a line and emulate a simple
parser. Although the rules that will be used to parse octave
expressions don't need to be thourough, they have to be sufficient
enough to detect transposition vs strings.

As far as I know, context free grammars are strictly more powerful
than regular expressions. A simple example is keeping track of [] and
(). So it might be impossible to generate a regular expression doing
what we want it to do.

Environments like Visual Studio and Eclipse do dynamic code analysis
all the time, so I would be surprised if emacs doesn't have some
equivalent parsing functionality.

Rosen,

2008/8/21 Chong Yidong <cyd@stupidchicken.com>:
> Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>
>> > Is there a way to assign two different syntax rules for the same
>> > character in emacs? Ie, one where ' is treated as a string quote
>> > (and suppresses the syntax elements inside the quotes), and one
>> > where it is treated as a suffix operator.
>>
>> Yes, there is, using the `syntax-table' property.  A common way to set
>> this property is via the font-lock-syntactic-keywords variable.
>>
>> So all it takes is a regexp good enough to distinguish the two cases
>
> Kurt Hornik <Kurt.Hornik@wu-wien.ac.at> wrote:
>
>> Octave mode has never provided syntax support for single quoted
>> strings because there is no way (short of actually parsing the code)
>> of telling these apart from single quotes used for transposition.
>
> Maybe we could use a rough heuristic to handle most of the cases.  A '
> character that occurs before "[=(] *" is probably the beginning of a
> single quoted string, not a transpose operator.  WDYT?
>






  reply	other threads:[~2008-08-21 18:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-21 15:55 bug#703: Octave comments in emacs Chong Yidong
2008-08-21 18:26 ` Rosen Diankov [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-08-13 22:18 Chong Yidong
2008-08-20 16:55 ` Kurt Hornik
2008-08-20 23:21   ` Rosen Diankov
2008-08-20 23:27     ` Rosen Diankov
2008-08-12  2:36 Rosen Diankov
2008-08-12 20:07 ` Rosen Diankov
2008-08-14 20:31   ` bug#703: " Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=103101d70808211126v513f4884i3c2759e0e2eae075@mail.gmail.com \
    --to=rdiankov@cs.cmu.edu \
    --cc=703@emacsbugs.donarmstrong.com \
    --cc=Kurt.Hornik@wu-wien.ac.at \
    --cc=cyd@stupidchicken.com \
    --cc=lefevrol@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).