does python have the ability to detect the color of a string inSPSS syntax.

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

does python have the ability to detect the color of a string inSPSS syntax.

Art Kendall

In the syntax window coloring is  used to distinguish  commands subcommands keywords values and comments.

Is there a way to have python parse syntax and
produce a dataset with variables like color bold italic command/subcommand/keyword  word
-- 
Art Kendall
Social Research Consultants
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: does python have the ability to detect the color of a string inSPSS syntax.

Jon K Peck
Yes, but this would be a lot of work.  First it would need to parse the syntax and identify all the token types.
If someone is so inclined, I should point out that if you look in the syntax_xml subdirectory of your Statistics installation, you will find an xml file describing the format for each standard Statistics command.  Add to this the xml files for extension commands, and you have a complete set.  Those files are in the extensions subdirectory or elsewhere on the extensions search path.  The files for built-in commands look, not coincidentally, a lot like the xml files one would create for an extension command.

These xml files are used by the SE to carry out its color coding and error checking. Of course, the SE has special logic to deal with block commands like begin/end program or begin/end GPL or begin/end data, since such blocks don't conform to standard syntax.



Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        Art Kendall <[hidden email]>
To:        [hidden email],
Date:        05/17/2013 01:57 PM
Subject:        [SPSSX-L] does python have the ability to detect the color of a              string              inSPSS syntax.
Sent by:        "SPSSX(r) Discussion" <[hidden email]>





In the syntax window coloring is  used to
distinguish  commands subcommands keywords values and comments.

Is there a way to have python parse syntax and
produce a dataset with variables like color bold italic command/subcommand/keyword  word

--
Art Kendall
Social Research Consultants

Art Kendall
Social Research Consultants



View this message in context: does python have the ability to detect the color of a string inSPSS syntax.
Sent from the
SPSSX Discussion mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: does python have the ability to detect the color of a string inSPSS syntax.

Albert-Jan Roskam
In reply to this post by Art Kendall
Hi Art,

In the spss install dir you can find a large amount of xml files, one for each command. These contain the command definitions (commands, subcommands, keywords, etc). Then you would still need to write a function that "tokenizes" each command in a given .sps and compares it to the relevant xml file. Why do you want to do this, if I may ask?

 
Regards,
Albert-Jan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a
fresh water system, and public health, what have the Romans ever done for us?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 

From: Art Kendall <[hidden email]>
To: [hidden email]
Sent: Friday, May 17, 2013 9:56 PM
Subject: [SPSSX-L] does python have the ability to detect the color of a string inSPSS syntax.


In the syntax window coloring is  used to distinguish  commands subcommands keywords values and comments.

Is there a way to have python parse syntax and
produce a dataset with variables like color bold italic command/subcommand/keyword  word
--
Art Kendall
Social Research Consultants
Art Kendall
Social Research Consultants


View this message in context: does python have the ability to detect the color of a string inSPSS syntax.
Sent from the SPSSX Discussion mailing list archive at Nabble.com.