eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'ProgrammingLanguage':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: ProgrammingLanguage


Inheritance:

   Object
   |
   +--ProgrammingLanguage
      |
      +--STXJavaScriptLanguage
      |
      +--SmalltalkLanguage

Package:
stx:libbasic
Category:
Kernel-Languages
Version:
rev: 1.50 date: 2019/06/27 10:38:16
user: cg
file: ProgrammingLanguage.st directory: libbasic
module: stx stc-classLibrary: libbasic

Description:


provide info about which tools are to be used for code in
a programming language


Class protocol:

Signal constants
o  languageQuerySignal

accessing
o  all
Anwers a collection of all available languages

usage example(s):

     ProgrammingLanguage all

o  allSortedByNameExcept: filterBlock
Anwers a collection of all available languages

usage example(s):

     ProgrammingLanguage allSortedByNameExcept:#isSmalltalk

o  current
ProgrammingLanguage current

o  instance
return this language's singleton

enumerating
o  allDetect: aBlock ifNone: exceptionValue

o  allDo: aBlock
ProgrammingLanguage allDo:[:l | Transcript showCR:l ]

initialization
o  initialize
(comment from inherited method)
called only once - initialize signals

instance creation
o  forFile: aFilename
Answers a language for given source file. If none is found,
SmalltalkLanguage is returned (to provide backward compatibility)

o  forStream: aStream
Answers a language for given source stream. If none is found,
SmalltalkLanguage is returned (to provide backward compatibility)

o  named: aString
ProgrammingLanguage named: 'Smalltalk'
ProgrammingLanguage named: 'JavaScript'
ProgrammingLanguage named: 'Ruby'

o  named: aString ifNone: aBlock

private
o  instancesDetect: detectBlock ifNone: failBlock
detect a langauge instance for which detectBlock returns true;
failBlock otherwise

queries
o  isAbstract

testing
o  isAvailable: langName
ProgrammingLanguage isAvailable: 'Smalltalk'
ProgrammingLanguage isAvailable: 'Ruby'
ProgrammingLanguage isAvailable: 'Haskell'


Instance protocol:

accessing
o  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 raises an error - it must be redefined in concrete classes **

o  imports
To make it polymorph with NameSpace for
selector-namespace enabled systems

o  lookup

o  name
Answers a human-readable name of myself:
'Smalltalk' for SmalltalkLanguage,
'Ruby' for RubyLanguage
...
Here, a fallback using the class name is generated.

o  sourceFileSuffix
Answers a default suffix for source files, i.e. 'st' for Smalltalk,
'js' for JavaScript or 'rb' for Ruby', etc.

** This method raises an error - it must be redefined in concrete classes **

o  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
o  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

o  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)

o  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

o  compilerWithBreakpointSupportClass
Answer a class suitable for compiling a source code with breakpoints
in 'my' language. If there is none, return nil.

o  evaluatorClass
Answer a class suitable for evaluating a doIt in 'my' language

o  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.

o  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.

o  lookupClass

o  metaClass
will be used for new classes (in the class wizard);
a fallback here

o  parserClass
Answer a class suitable for parsing a source code in 'my' language

** This method raises an error - it must be redefined in concrete classes **

o  sourceFileReaderClass
Answers a class that can be used for reading & compiling source files

** This method raises an error - it must be redefined in concrete classes **

o  sourceFileWriterClass
Answers a class is used for source file writing (i.e. file-out)

** This method raises an error - it must be redefined in concrete classes **

o  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

o  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

o  valuePrinterClass
Answers a class used by the workspace to print a value.
If nil, the regular printOn: method is called for

displaying
o  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
o  printOn: aStream
append a printed representation of the receiver to the argument, aStream

o  storeOn: aStream
ProgrammingLanguage instance storeString

SmalltalkLanguage instance storeString

queries
o  canReadSourceFile: aFilename
Answers true iff file contains source code in 'my' language

o  defaultSelectorNameSpacePrefix
no namespace by default"

o  supportsExtensionMethods
Answer true iff this language supports extension methods

source queries
o  bracketStrings
used for autoindent

o  commentStrings
EOL comment

o  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:

o  methodDefinitionTemplateForSelector: arg1 andArgumentNames: arg2
raise an error: must be redefined in concrete subclass(es)

** This method raises an error - it must be redefined in concrete classes **

testing
o  isGroovy
true iff this is the Groovy language

o  isJava
true iff this is the Java language

o  isJavaLike
true if receiver is kind of Java language (based on Java)

o  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.

o  isRuby
true iff this is the ruby language

o  isSTXJavaScript
true iff this is the ST/X-javascript language

o  isSmalltalk
true iff this is the smalltalk language

utilities - file in/file out
o  fileIn: aFilename

o  fileInStream: aStream

utilities - source code
o  methodSourceForVersionMethodCVS: versionString

o  methodTemplate
return a method definition template string (or nil)

usage example(s):

^ writerClass methodTemplate

o  methodTemplateForDocumentation
return a documentation method definition template string (or nil)

o  methodTemplateForPackageDocumentation
return a documentation method definition template string (or nil) for packages

o  methodTemplateForVersionMethodCVS

o  parenthesisSpecificationForEditor

o  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) **

o  writeComment: aStringOrStringCollection on: aStream
Utility method - writes a comment to a stream,
using proper syntax



ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Thu, 18 Apr 2024 14:37:15 GMT