|
Class: ProgrammingLanguage
Object
|
+--ProgrammingLanguage
|
+--STXJavaScriptLanguage
|
+--SmalltalkLanguage
- Package:
- stx:libbasic
- Category:
- Kernel-Languages
- Version:
- rev:
1.60
date: 2023/01/26 14:27:18
- user: cg
- file: ProgrammingLanguage.st directory: libbasic
- module: stx stc-classLibrary: libbasic
provide info about which tools are to be used for code in
a programming language
copyrightCOPYRIGHT (c) 2006 by eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
Signal constants
-
languageQuerySignal
-
accessing
-
all
-
Anwers a collection of all available languages
Usage example(s):
-
allSortedByNameExcept: filterBlock
-
Anwers a collection of all available languages
Usage example(s):
ProgrammingLanguage allSortedByNameExcept:#isSmalltalk
|
-
current
-
ProgrammingLanguage current
-
instance
-
return this language's singleton
enumerating
-
allDetect: aBlock ifNone: exceptionValue
-
-
allDo: aBlock
-
ProgrammingLanguage allDo:[:l | Transcript showCR:l ]
initialization
-
initialize
-
(comment from inherited method)
called only once - initialize signals
instance creation
-
forFile: aFilename
-
Answers a language for given source file. If none is found,
SmalltalkLanguage is returned (to provide backward compatibility)
-
forStream: aStream
-
Answers a language for given source stream. If none is found,
SmalltalkLanguage is returned (to provide backward compatibility)
-
named: aString
-
ProgrammingLanguage named: 'Smalltalk'
ProgrammingLanguage named: 'JavaScript'
ProgrammingLanguage named: 'Ruby'
-
named: aString ifNone: aBlock
-
private
-
instancesDetect: detectBlock ifNone: failBlock
-
detect a langauge instance for which detectBlock returns true;
failBlock otherwise
queries
-
isAbstract
-
Return if this class is an abstract class.
True is returned here for myself only; false for subclasses.
Abstract subclasses must redefine this again.
testing
-
isAvailable: langName
-
ProgrammingLanguage isAvailable: 'Smalltalk'
ProgrammingLanguage isAvailable: 'Ruby'
ProgrammingLanguage isAvailable: 'Haskell'
accessing
-
id
-
Return a unique integer id of this language.
For languages built into the VM, it must be < 32.
This id is used as index to various structures used by runtime
(bytecode set ?).
cg: this ought to be better documented - I have no idea, where it is used
** This method must be redefined in concrete classes (subclassResponsibility) **
-
imports
-
To make it polymorph with NameSpace for
selector-namespace enabled systems
-
lookup
-
-
name
-
Answers a human-readable name of myself:
'Smalltalk' for SmalltalkLanguage,
'Ruby' for RubyLanguage
...
Here, a fallback using the class name is generated.
-
sourceFileSuffix
-
Answers a default suffix for source files, i.e. 'st' for Smalltalk,
'js' for JavaScript or 'rb' for Ruby', etc.
** This method must be redefined in concrete classes (subclassResponsibility) **
-
toolbox
( an extension from the stx:libtool package )
-
Answer a toolbox for receiver. A toolbox is used by language-agnostic tools (such as
class browser) to perform language-specific tasks (search for implementors,
build implementor menu and so on. If nil is returned, no toolbox available
accessing-classes
-
codeGeneratorClass
-
Answer a class suitable for generating code (such as getters, setters, etc.)
It is ok to return nil, which means that no code can be generated automagically
-
compilerClass
-
Answer a class suitable for compiling a source code in 'my' language.
If nil is returned, no compiler is available (eg. language is for editors only)
-
compilerClassForInteractiveTools
-
Answer a compiler class suitable for usage in interactive tools.
Such class may better integrate into the IDE and register for undo/redo
and/or do more checks and so on. Defaults to #compilerClass
-
compilerWithBreakpointSupportClass
-
Answer a class suitable for compiling a source code with breakpoints
in 'my' language. If there is none, return nil.
-
evaluatorClass
-
Answer a class suitable for evaluating a doIt in 'my' language
-
explainerClass
-
Answers a class used by browser and debugger to
show some hints about the code. It is OK to return
nil, which means that there is no explainer for given
language.
-
formatterClass
-
Answer a class suitable for prettyPrinting (indenting) code in 'my' language.
It is ok to return nil, which means that the browser will not be able to prettyprint.
-
lookupClass
-
-
metaClass
-
will be used for new classes (in the class wizard);
a fallback here
-
parserClass
-
Answer a class suitable for parsing a source code in 'my' language
** This method must be redefined in concrete classes (subclassResponsibility) **
-
sourceFileReaderClass
-
Answers a class that can be used for reading & compiling source files
** This method must be redefined in concrete classes (subclassResponsibility) **
-
sourceFileWriterClass
-
Answers a class is used for source file writing (i.e. file-out)
** This method must be redefined in concrete classes (subclassResponsibility) **
-
syntaxHighlighterClass
-
Answers a class used by browser and debugger to colorize code.
It is OK to return nil, which means that the code is shown as-is
-
toolboxClass
( an extension from the stx:libtool package )
-
Answer a 'toolbox class'. A toolbox is used by language-agnostic tools (such as
class browser) to perform language-specific tasks (search for implementors,
build implementor menu and so on. If nil is returned, no toolbox available
-
valuePrinterClass
-
Answers a class used by the workspace to print a value.
If nil, the regular printOn: method is called on the result object.
If provided, it should respond to printStringForPrintItOf:result
displaying
-
displayString
( an extension from the stx:libtool package )
-
(comment from inherited method)
return a string used when displaying the receiver in a view;
for example an Inspector. This is usually the same as printString,
but sometimes redefined for a better look.
Notice: displayString and displayOn: are for developers, debugging and inspectors,
whereas printString and printOn: are for the program to print data.
Note: the base method (used by the inspector) is #displayOn:.
So you should implement #displayOn: instead of #displayString in subclasses.
printing & storing
-
printOn: aStream
-
append a printed representation of the receiver to the argument, aStream
-
storeOn: aStream
-
ProgrammingLanguage instance storeString
SmalltalkLanguage instance storeString
queries
-
canBeCompiled
-
true if compilable in the browser
-
canReadSourceFile: aFilename
-
Answers true iff file contains source code in 'my' language
-
defaultSelectorNameSpacePrefix
-
no namespace by default"
-
supportsExtensionMethods
-
Answer true iff this language supports extension methods
source queries
-
bracketStrings
-
used for autoindent
-
commentStrings
-
EOL comment
-
methodDefinitionTemplateForSelector: aSelector
-
given a selector, return a prototype definition string
Usage example(s):
SmalltalkLanguage instance methodDefinitionTemplateForSelector:#foo
SmalltalkLanguage instance methodDefinitionTemplateForSelector:#+
SmalltalkLanguage instance methodDefinitionTemplateForSelector:#foo:bar:baz:
|
-
methodDefinitionTemplateForSelector: arg1 andArgumentNames: arg2
-
raise an error: must be redefined in concrete subclass(es)
** This method must be redefined in concrete classes (subclassResponsibility) **
testing
-
isC
-
true iff this is the C language
-
isGroovy
-
true iff this is the Groovy language
-
isJava
-
true iff this is the Java language
-
isJavaLike
-
true if receiver is kind of Java language (based on Java)
-
isProgrammingLanguage
-
(comment from inherited method)
return true if the receiver is a programming language.
False is returned here - the method is only redefined in
ProgrammingLanguage.
-
isPython
-
true iff this is the python language
-
isRuby
-
true iff this is the ruby language
-
isSTXJavaScript
-
true iff this is the ST/X-javascript language
-
isSmalltalk
-
true iff this is the smalltalk language
utilities - file in/file out
-
fileIn: aFilenameOrString
-
-
fileInStream: aStream
-
utilities - source code
-
methodSourceForVersionMethodCVS: versionString
-
-
methodTemplate
-
return a method definition template string (or nil)
Usage example(s):
^ writerClass methodTemplate
|
-
methodTemplateForDocumentation
-
return a documentation method definition template string (or nil)
-
methodTemplateForPackageDocumentation
-
return a documentation method definition template string (or nil) for packages
-
methodTemplateForVersionMethodCVS
-
-
parenthesisSpecificationForEditor
-
return the dictionary which specifies which characters are opening,
which are closing and which are ignored characters w.r.t. parenthesis matching.
See comments in TextView on how this is used.
-
versionMethodTemplateForCVS
-
raise an error: must be redefined in concrete subclass(es)
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
writeComment: aStringOrStringCollection on: aStream
-
Utility method - writes a comment to a stream,
using proper syntax
|