ProgrammingLanguage.st
changeset 12099 396c8fa4a39a
parent 12056 6342579137b7
child 12101 715a89a8a8bc
--- a/ProgrammingLanguage.st	Fri Oct 02 11:10:19 2009 +0200
+++ b/ProgrammingLanguage.st	Fri Oct 02 11:10:23 2009 +0200
@@ -1,14 +1,3 @@
-"
- COPYRIGHT (c) 2009 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.
-"
 "{ Package: 'stx:libbasic' }"
 
 Object subclass:#ProgrammingLanguage
@@ -25,21 +14,6 @@
 "
 !
 
-!ProgrammingLanguage class methodsFor:'documentation'!
-
-copyright
-"
- COPYRIGHT (c) 2009 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.
-"
-! !
 
 !ProgrammingLanguage class methodsFor:'initialization'!
 
@@ -58,8 +32,7 @@
 !ProgrammingLanguage class methodsFor:'instance creation'!
 
 forFile: aFilename 
-    "
-     Answers a language for given source file. If none is found,
+    "Answers a language for given source file. If none is found,
      SmalltalkLanguage is returned (to provide backward compatibility)"
     
     ^ self instancesDetect: [:each | each canReadSourceFile: aFilename ]
@@ -69,8 +42,7 @@
 !
 
 forStream: aStream 
-    "
-     Answers a language for given source stream. If none is found,
+    "Answers a language for given source stream. If none is found,
      SmalltalkLanguage is returned (to provide backward compatibility)"
     
     aStream isFileStream ifFalse: [ ^ SmalltalkLanguage instance ].
@@ -121,7 +93,7 @@
 
 
     "
-        ProgrammingLanguage all
+     ProgrammingLanguage all
     "
 
     "Created: / 16-08-2009 / 13:43:41 / Jan Vrany <vranyj1@fel.cvut.cz>"
@@ -130,7 +102,7 @@
 current
 
     "
-        ProgrammingLanguage current
+     ProgrammingLanguage current
     "
 
 
@@ -140,6 +112,7 @@
 !
 
 instance
+    "return this languages singleton"
 
     Instance ifNil:[Instance := self new].
     ^Instance
@@ -188,10 +161,10 @@
 !ProgrammingLanguage methodsFor:'accessing'!
 
 name
-    "
-     Answers a human-readable name of myself:
+    "Answers a human-readable name of myself:
      'Smalltalk' for SmalltalkLanguage,
-     'Ruby' for RubyLanguage...
+     'Ruby' for RubyLanguage
+     ...
     "
 
     ^ self subclassResponsibility
@@ -201,11 +174,8 @@
 !
 
 sourceFileSuffix
-
-    "
-     Answers a default suffix for source files, i.e.
-     'st' for Smalltalk, 'js' for JavaScript or 'rb' for Ruby'
-    "
+    "Answers a default suffix for source files, i.e. 'st' for Smalltalk, 
+     'js' for JavaScript or 'rb' for Ruby', etc."
 
     ^self subclassResponsibility
 
@@ -215,24 +185,24 @@
 !ProgrammingLanguage methodsFor:'accessing - classes'!
 
 compilerClass
-    "
-        Answer a class suitable for compiling a source code
-        in 'my' language
-    "
+    "Answer a class suitable for compiling a source code in 'my' language"
 
     ^self subclassResponsibility
 
     "Created: / 21-08-2009 / 13:00:50 / Jan Vrany <vranyj1@fel.cvut.cz>"
 !
 
-explainerClass
+evaluatorClass
+    "Answer a class suitable for evaluating a doIt in 'my' language"
+
+    ^ self compilerClass
+!
 
-    "
-        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.
-    "
+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."
 
     "return nil by default"
     ^nil
@@ -240,11 +210,15 @@
     "Created: / 21-08-2009 / 08:49:13 / Jan Vrany <vranyj1@fel.cvut.cz>"
 !
 
+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."
+
+    ^ nil
+!
+
 parserClass
-    "
-        Answer a class suitable for parsing a source code
-        in 'my' language
-    "
+    "Answer a class suitable for parsing a source code in 'my' language"
 
     ^self subclassResponsibility
 
@@ -252,11 +226,7 @@
 !
 
 sourceFileReaderClass
-
-    "
-        Answers a class that can be used for 
-        reading & compiling source files
-    "
+    "Answers a class that can be used for reading & compiling source files"
 
     ^self subclassResponsibility
 
@@ -264,15 +234,19 @@
 !
 
 sourceFileWriterClass
-
-    "
-        Answers a class is used for source file
-        writing (i.e. file-out)            
-    "
+    "Answers a class is used for source file writing (i.e. file-out)"
 
     ^self subclassResponsibility
 
     "Created: / 16-08-2009 / 09:40:19 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+syntaxHighlighterClass
+    "Answers a class used by browser and debugger to colorze code.
+     It is OK to return nil, which means that the code is shown as-is"
+
+    "return nil by default"
+    ^nil
 ! !
 
 !ProgrammingLanguage methodsFor:'printing & storing'!
@@ -300,13 +274,9 @@
 !ProgrammingLanguage methodsFor:'queries'!
 
 canReadSourceFile: aFilename
-    "
-    Answers true iff file contains source code
-    in 'my' language        
-    "
+    "Answers true iff file contains source code in 'my' language"
 
-    "Trivial implementation here, to be overriden by
-     subclasses"
+    "Trivial implementation here, to be overriden by subclasses"
 
     ^aFilename suffix = self sourceFileSuffix
 
@@ -341,11 +311,11 @@
 !ProgrammingLanguage methodsFor:'utilities - source code'!
 
 writeComment: aStringOrStringCollection on: aStream 
-    "
-        Utility method - writes a comment to a stream
-        using proper syntax"
+    "Utility method - writes a comment to a stream,
+     using proper syntax"
     
-    ^ self sourceFileWriterClass new fileOutComment: aStringOrStringCollection
+    ^ self sourceFileWriterClass new 
+        fileOutComment: aStringOrStringCollection
         on: aStream
 
     "Created: / 21-08-2009 / 09:35:07 / Jan Vrany <vranyj1@fel.cvut.cz>"
@@ -354,11 +324,11 @@
 !ProgrammingLanguage class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ProgrammingLanguage.st,v 1.4 2009-09-30 12:06:36 fm Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ProgrammingLanguage.st,v 1.5 2009-10-02 09:10:23 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/ProgrammingLanguage.st,v 1.4 2009-09-30 12:06:36 fm Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ProgrammingLanguage.st,v 1.5 2009-10-02 09:10:23 cg Exp $'
 !
 
 version_SVN