Google Groups Home
Help | Sign in
syntax highlight on the fly?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  10 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
noman9607  
View profile
 More options Jun 29, 5:02 pm
From: noman9607 <pgb9...@yahoo.com>
Date: Sun, 29 Jun 2008 14:02:44 -0700 (PDT)
Local: Sun, Jun 29 2008 5:02 pm
Subject: syntax highlight on the fly?
I would like to highlight words based on grep's etc that I do in my
programs. These word sets are not meant to last a long time. I just
discovered the 'Overlay settings from mapping text file' in the
\Options\configure systaxhitlite mapping sets menu. Can I use this
option setting in a macro that will run the overlay file when the file
is opened? I don't see a way to do this from the command line (future
feature Sam?) but I can generate the overlay file in my own program
and save it to a hard coded file name that  a tse macro might run if
that will work.
The syntax files are binary so I do not want to tackle the problem
that way.
thanks,

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
knud van eeden  
View profile
 More options Jun 30, 4:40 pm
From: knud van eeden <knud_van_ee...@yahoo.com>
Date: Mon, 30 Jun 2008 13:40:02 -0700 (PDT)
Local: Mon, Jun 30 2008 4:40 pm
Subject: Re: [TSE] syntax highlight on the fly?
Can you show a very simple example?
With friendly greetings
Knud van Eeden


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kyle Waters  
View profile
 More options Jul 1, 4:32 am
From: "Kyle Waters" <k...@rfm-inc.com>
Date: Tue, 1 Jul 2008 04:32:22 -0400
Local: Tues, Jul 1 2008 4:32 am
Subject: RE: [TSE] Re: syntax highlight on the fly?

Thank-You,
Kyle


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
noman9607  
View profile
 More options Jul 2, 1:25 pm
From: noman9607 <pgb9...@yahoo.com>
Date: Wed, 2 Jul 2008 10:25:04 -0700 (PDT)
Local: Wed, Jul 2 2008 1:25 pm
Subject: Re: syntax highlight on the fly?
Here is a current example. I have the novel "Don Quixote" loaded (from
project Gutenberg) to study and later write a paper. I use TSE like a
database because it is so fast. I search using [alt+v]for say 'barber'
and 'curate' then look at the results and from that I get a list of
words like:
Treasury
various
poems
books
author
barber
curate
    Now I want the words in the list above 'syntax hilited' because
although I could have used TSE to go to the lines where the patterns
were found the results are too narrow; by looking at these words
hilited it is easy to tie ideas together paragraphs and pages from the
narrow focus of the one-line grep search. It takes too long to add
these 'keywords' to the 'language' in the normal programming sense. I
can generate a 'overlay' text file by editing or by using basic
program with the words I want to hilite in it. Using the full options
menu as I stated above you can overlay the settings using the file you
just created progrmmatically but now is the key idea: I want to run
the options setup including the new 'overlay settings from mapping
text fle...' when I start TSE from the command line. The following is
'made-up' command line. I think the solution will have to be a
automatically loaded macro.

g32.exe overlay-dq.txt DonQuixote.txt

It is handy to hilite words if you can do it quickly and easily
thanks for your help.

On Jun 30, 4:40 pm, knud van eeden <knud_van_ee...@yahoo.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
knud van eeden  
View profile
 More options Jul 2, 1:27 pm
From: knud van eeden <knud_van_ee...@yahoo.com>
Date: Wed, 2 Jul 2008 10:27:53 -0700 (PDT)
Local: Wed, Jul 2 2008 1:27 pm
Subject: Re: [TSE] Re: syntax highlight on the fly?

> I use TSE like a database because it is so fast.

Just shaking hands

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
knud van eeden  
View profile
 More options Jul 4, 11:38 am
From: knud van eeden <knud_van_ee...@yahoo.com>
Date: Fri, 4 Jul 2008 08:38:55 -0700 (PDT)
Local: Fri, Jul 4 2008 11:38 am
Subject: Re: [TSE] Re: syntax highlight on the fly?
Some ideas:
In general, what I can think of is, as a first maybe possible approach:
1. Get all the unique words of your (e.g. Gutenberg) file (e.g. save this in file 'yourExample.ext')
(using e.g. something like a TSE macro or otherwise a combination of pipe and redirect
  split | unique | sort >yourKeywords.txt
)
2. Use this yourKeywords.txt file to generate a
    TSE syntax highlight file (e.g. yoursyntaxhighlight) for a particular extension (e.g. .ext)
You can maybe e.g. concatenate minimally the string
[keyWords1]
in front of your unique keyword file to get at least 1 different color,
then save the result
3. On that file you run that standard TSE macro
    syncfg2.mac
(it might have to be recompiled/redesigned to accept a .txt filename as a command line parameter)
4. you copy the resulting .syn (e.g. yourwords.syn) to the TSE synhi directory
5. Then you activate this syntax highlight file (e.g. if extension is .ext then highlight that file)
But usually you will have to quit and reload tse to activate it, as far as I know.
So you might have to start TSE using a batch file.
Something like a file mybatchfile.bat containing at least something like (loading TSE twice thus,
the first time to activate the new syntax highlight, the second time to show that new highlight.
g32.exe yourGutenberg.ext -eyourMacro.mac
g32.exe yourGutenberg.ext
exit
===
Troubleshooting:
-You get too many unique words, giving problems for syntax highlighting maximum size files
So you might have to make some (manual) decisions what to take and what to throw away.
Just some thoughts,
with friendly greetings,
Knud van Eeden
  


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
noman9607  
View profile
 More options Jul 6, 1:50 am
From: noman9607 <pgb9...@yahoo.com>
Date: Sat, 5 Jul 2008 22:50:08 -0700 (PDT)
Local: Sun, Jul 6 2008 1:50 am
Subject: Re: syntax highlight on the fly?
Hello:
I can get the keyword list ok
but I don't understand the syntax of the syncfg2 macro...
How do I 'run' the list file against it?
Somehow the tse editor uses the ascii.txt file that is made when you
choose
'write settings to mapping text file' in the options menu.

I can modify the [keywords#]sections easily using my own programs but
how do I run
syncfg2.mac against that file, presuming that one can?

If I could run sc32 to compile the macro before g32 eMyMac,
then g32 eMyMac might work.

Is there some way to duplicate the 'Overlay Settings from Mapping Text
File'
that is in the Options menu by command line using sc32? TSE has to be
compiling the
syn file at this time using the user interface config, I just need to
do it at
the command line.
That would do the trick.

On Jul 4, 11:38 am, knud van eeden <knud_van_ee...@yahoo.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Carlo Hogeveen  
View profile
 More options Jul 6, 11:03 am
From: "Carlo Hogeveen" <Carlo.Hogev...@xs4all.nl>
Date: Sun, 6 Jul 2008 17:03:49 +0200
Local: Sun, Jul 6 2008 11:03 am
Subject: RE: [TSE] Re: syntax highlight on the fly?

/*
   This example macro toggles syntax-hiliting on-the-fly
   for the "proc" word in TSE's own macro language,
   for example for this macro source.

   Points of interest:
   - The .syn file needs to be loaded in binary mode 2.
     See in TSE's Help the topic BinaryMode() for an explanation.
   - Syncfg2 converts to an unsaved file in the CURRENT directory.
   - The TSE compiler does not understand the documented LinkSynFile
     parameter _ALWAYS_LOAD_: use -1 instead.
*/

string syntaxfile_name [255] = "f:\tse32\synhi\sal.syn"

proc Main()
   integer original_id = GetBufferId()
   integer syntaxfile_id = EditThisFile("-b-2 " + syntaxfile_name)
   integer textfile_id = 0
   ExecMacro("syncfg2")
   if CurrExt() == ".txt" // Did syncfg2 succeed?
      textfile_id = GetBufferId()
      AbandonFile(syntaxfile_id)
      // Toggle syntax hiliting for "proc".
      if lFind("proc", "giw")
         lReplace("proc", "noproc", "ginw")
      else
         lReplace("noproc", "proc", "ginw")
      endif
      ExecMacro("syncfg2")
      if CurrExt() == ".syn" // Did syncfg2 succeed?
         syntaxfile_id = GetBufferId()
         AbandonFile(textfile_id)
         // Saving .syn file using original dir instead of current dir!
         SaveAs(syntaxfile_name, _OVERWRITE_)
         GotoBufferId(original_id)
         AbandonFile(syntaxfile_id)
         // Relink the new syntax hiliting file ALWAYS (-1).
         LinkSynFile(syntaxfile_name, -1)
         UpdateDisplay(_ALL_WINDOWS_REFRESH_) // Just in case.
      endif
   endif
   PurgeMacro(SplitPath(CurrMacroFilename(), _NAME_))
end


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
knud van eeden  
View profile
 More options Jul 6, 2:56 pm
From: knud van eeden <knud_van_ee...@yahoo.com>
Date: Sun, 6 Jul 2008 11:56:27 -0700 (PDT)
Local: Sun, Jul 6 2008 2:56 pm
Subject: Re: [TSE] Re: syntax highlight on the fly?
Computer: Editor: TSE: Syntax: Highlight: How to possibly convert automatically a .txt file to .syn file?
http://www.knudvaneeden.com/tinyurl.php?urlKey=url000141

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
knud van eeden  
View profile
 More options Jul 6, 2:57 pm
From: knud van eeden <knud_van_ee...@yahoo.com>
Date: Sun, 6 Jul 2008 11:57:51 -0700 (PDT)
Local: Sun, Jul 6 2008 2:57 pm
Subject: Re: [TSE] Re: syntax highlight on the fly?
Computer: Editor: TSE: Syntax: Highlight: How to possibly create syntax highlighting for your XML file?
http://www.knudvaneeden.com/tinyurl.php?urlKey=url000142

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google