et facta est lux
This commit is contained in:
3
src/.properties
Normal file
3
src/.properties
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
#format : #tonel
|
||||
}
|
194
src/Carp/CarpParser.class.st
Normal file
194
src/Carp/CarpParser.class.st
Normal file
@@ -0,0 +1,194 @@
|
||||
Class {
|
||||
#name : #CarpParser,
|
||||
#superclass : #SmaCCGLRParser,
|
||||
#category : #Carp
|
||||
}
|
||||
|
||||
{ #category : #'generated-accessing' }
|
||||
CarpParser class >> cacheId [
|
||||
^'2020-10-05T22:57:25.346883+02:00'
|
||||
]
|
||||
|
||||
{ #category : #generated }
|
||||
CarpParser class >> definitionComment [
|
||||
"%glr;
|
||||
|
||||
<hexa>
|
||||
: [0-9a-fA-F]
|
||||
;
|
||||
<escape>
|
||||
: \\ ([^\r\n] | (u <hexa>{4,4}))+
|
||||
;
|
||||
<string_literal>
|
||||
: (\"" ([^\""\\] | <escape>)* \"")
|
||||
;
|
||||
<open_paren>
|
||||
: \(
|
||||
;
|
||||
<close_paren>
|
||||
: \)
|
||||
;
|
||||
<quote>
|
||||
: \'
|
||||
;
|
||||
<variable_start>
|
||||
: <isLowercase> | _ | \$ | \+ | \* | \/ | \? | ! | > | < | = | :
|
||||
;
|
||||
default <variable>
|
||||
: <variable_start> <variable_part>*
|
||||
;
|
||||
<variable_part>
|
||||
: <variable_start> | <isDigit>
|
||||
;
|
||||
<module>
|
||||
: <isUppercase> <variable_part>*
|
||||
;
|
||||
<space>
|
||||
: (<isSpaceSeparator> | ,)+
|
||||
;
|
||||
<dot>
|
||||
: \.
|
||||
;
|
||||
<Symbol>
|
||||
: a
|
||||
;
|
||||
<open_bracket>
|
||||
: \[
|
||||
;
|
||||
<close_bracket>
|
||||
: \]
|
||||
;
|
||||
<binary_integer>
|
||||
: 0 b [0-1]
|
||||
;
|
||||
<hex_integer>
|
||||
: 0 x [0-9a-fA-F]
|
||||
;
|
||||
<decimal_integer>
|
||||
: [0-9]+
|
||||
;
|
||||
<decimal>
|
||||
: (<decimal_integer> \. <decimal_integer> f?)
|
||||
| (<decimal_integer> (f|l|b)?)
|
||||
;
|
||||
<numeric_literal>
|
||||
: <decimal> | <hex_integer> | <binary_integer>
|
||||
;Start
|
||||
: Expression+
|
||||
;
|
||||
Expression
|
||||
: Literal
|
||||
;
|
||||
Literal
|
||||
: String | List | Array | Symbol | Quote | Number
|
||||
;
|
||||
Number
|
||||
: <numeric_literal>
|
||||
;
|
||||
Array
|
||||
: <open_bracket> ListContents <close_bracket>
|
||||
;
|
||||
Quote
|
||||
: <quote> Expression
|
||||
;
|
||||
Symbol
|
||||
: ModuleOrType | Variable
|
||||
;
|
||||
Variable
|
||||
: <variable>
|
||||
;
|
||||
ModuleOrType
|
||||
: <module> <dot> Symbol
|
||||
| <module>
|
||||
;
|
||||
List
|
||||
: <open_paren> ListContents <close_paren>
|
||||
;
|
||||
ListContents
|
||||
: Expression <space> ListContents
|
||||
| Expression
|
||||
;
|
||||
String
|
||||
: <string_literal>
|
||||
;"
|
||||
]
|
||||
|
||||
{ #category : #generated }
|
||||
CarpParser class >> reduceTable [
|
||||
^#(
|
||||
#(25 1 #reduceFor: 1310721 false )
|
||||
#(21 1 #reduceFor: 1111041 false )
|
||||
#(22 1 #reduceFor: 1137666 false )
|
||||
#(17 1 #reduceFor: 952321 false )
|
||||
#(13 1 #reduceFor: 837633 false )
|
||||
#(14 1 #reduceFor: 847873 false )
|
||||
#(15 1 #reduceFor: 863233 false )
|
||||
#(16 1 #reduceFor: 888838 false )
|
||||
#(16 1 #reduceFor: 888835 false )
|
||||
#(16 1 #reduceFor: 888837 false )
|
||||
#(16 1 #reduceFor: 888836 false )
|
||||
#(20 1 #reduceFor: 1073154 false )
|
||||
#(20 1 #reduceFor: 1073153 false )
|
||||
#(16 1 #reduceFor: 888834 false )
|
||||
#(16 1 #reduceFor: 888833 false )
|
||||
#(24 1 #reduceFor: 1244162 false )
|
||||
#(19 2 #reduceFor: 1041409 false )
|
||||
#(14 2 #reduceFor: 847874 false )
|
||||
#(23 3 #reduceFor: 1191937 false )
|
||||
#(22 3 #reduceFor: 1137665 false )
|
||||
#(18 3 #reduceFor: 984065 false )
|
||||
#(24 3 #reduceFor: 1244161 false )
|
||||
).
|
||||
]
|
||||
|
||||
{ #category : #generated }
|
||||
CarpParser class >> scannerClass [
|
||||
^CarpScanner
|
||||
]
|
||||
|
||||
{ #category : #generated }
|
||||
CarpParser class >> startingStateForStart [
|
||||
^ 1
|
||||
]
|
||||
|
||||
{ #category : #generated }
|
||||
CarpParser class >> symbolNames [
|
||||
^ #('<string_literal>' '<open_paren>' '<close_paren>' '<quote>' '<variable>' '<module>' '<space>' '<dot>' '<open_bracket>' '<close_bracket>' '<numeric_literal>' 'B e g i n' 'Start' 'Expression+' 'Expression' 'Literal' 'Number' 'Array' 'Quote' 'Symbol' 'Variable' 'ModuleOrType' 'List' 'ListContents' 'String' 'E O F' 'error')
|
||||
]
|
||||
|
||||
{ #category : #generated }
|
||||
CarpParser class >> transitionTable [
|
||||
^#(
|
||||
#[1 0 9 0 1 0 13 0 2 0 17 0 4 0 21 0 5 0 25 0 6 0 29 0 9 0 33 0 11 0 37 0 13 0 41 0 14 0 45 0 15 0 49 0 16 0 53 0 17 0 57 0 18 0 61 0 19 0 65 0 20 0 69 0 21 0 73 0 22 0 77 0 23 0 81 0 25]
|
||||
#[0 0 6 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 9 0 10 0 11 0 26]
|
||||
#[1 0 9 0 1 0 13 0 2 0 17 0 4 0 21 0 5 0 25 0 6 0 29 0 9 0 33 0 11 0 85 0 15 0 49 0 16 0 53 0 17 0 57 0 18 0 61 0 19 0 65 0 20 0 69 0 21 0 73 0 22 0 77 0 23 0 89 0 24 0 81 0 25]
|
||||
#[1 0 9 0 1 0 13 0 2 0 17 0 4 0 21 0 5 0 25 0 6 0 29 0 9 0 33 0 11 0 93 0 15 0 49 0 16 0 53 0 17 0 57 0 18 0 61 0 19 0 65 0 20 0 69 0 21 0 73 0 22 0 77 0 23 0 81 0 25]
|
||||
#[0 0 10 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 9 0 10 0 11 0 26]
|
||||
#[1 0 14 0 1 0 14 0 2 0 14 0 3 0 14 0 4 0 14 0 5 0 14 0 6 0 14 0 7 0 97 0 8 0 14 0 9 0 14 0 10 0 14 0 11 0 14 0 26]
|
||||
#[1 0 9 0 1 0 13 0 2 0 17 0 4 0 21 0 5 0 25 0 6 0 29 0 9 0 33 0 11 0 85 0 15 0 49 0 16 0 53 0 17 0 57 0 18 0 61 0 19 0 65 0 20 0 69 0 21 0 73 0 22 0 77 0 23 0 101 0 24 0 81 0 25]
|
||||
#[0 0 18 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 9 0 10 0 11 0 26]
|
||||
#[0 0 0 0 26]
|
||||
#[1 0 9 0 1 0 13 0 2 0 17 0 4 0 21 0 5 0 25 0 6 0 29 0 9 0 33 0 11 0 105 0 15 0 49 0 16 0 53 0 17 0 57 0 18 0 61 0 19 0 65 0 20 0 69 0 21 0 73 0 22 0 77 0 23 0 81 0 25 0 22 0 26]
|
||||
#[0 0 26 0 1 0 2 0 4 0 5 0 6 0 9 0 11 0 26]
|
||||
#[0 0 30 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 9 0 10 0 11 0 26]
|
||||
#[0 0 34 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 9 0 10 0 11 0 26]
|
||||
#[0 0 38 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 9 0 10 0 11 0 26]
|
||||
#[0 0 42 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 9 0 10 0 11 0 26]
|
||||
#[0 0 46 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 9 0 10 0 11 0 26]
|
||||
#[0 0 50 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 9 0 10 0 11 0 26]
|
||||
#[0 0 54 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 9 0 10 0 11 0 26]
|
||||
#[0 0 58 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 9 0 10 0 11 0 26]
|
||||
#[0 0 62 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 9 0 10 0 11 0 26]
|
||||
#[1 0 66 0 3 0 109 0 7 0 66 0 10]
|
||||
#[0 0 113 0 3]
|
||||
#[0 0 70 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 9 0 10 0 11 0 26]
|
||||
#[1 0 21 0 5 0 25 0 6 0 117 0 20 0 69 0 21 0 73 0 22]
|
||||
#[0 0 121 0 10]
|
||||
#[0 0 74 0 1 0 2 0 4 0 5 0 6 0 9 0 11 0 26]
|
||||
#[1 0 9 0 1 0 13 0 2 0 17 0 4 0 21 0 5 0 25 0 6 0 29 0 9 0 33 0 11 0 85 0 15 0 49 0 16 0 53 0 17 0 57 0 18 0 61 0 19 0 65 0 20 0 69 0 21 0 73 0 22 0 77 0 23 0 125 0 24 0 81 0 25]
|
||||
#[0 0 78 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 9 0 10 0 11 0 26]
|
||||
#[0 0 82 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 9 0 10 0 11 0 26]
|
||||
#[0 0 86 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 9 0 10 0 11 0 26]
|
||||
#[0 0 90 0 3 0 10]
|
||||
).
|
||||
]
|
177
src/Carp/CarpScanner.class.st
Normal file
177
src/Carp/CarpScanner.class.st
Normal file
@@ -0,0 +1,177 @@
|
||||
Class {
|
||||
#name : #CarpScanner,
|
||||
#superclass : #SmaCCScanner,
|
||||
#category : #Carp
|
||||
}
|
||||
|
||||
{ #category : #generated }
|
||||
CarpScanner >> emptySymbolTokenId [
|
||||
^ 26
|
||||
]
|
||||
|
||||
{ #category : #generated }
|
||||
CarpScanner >> errorTokenId [
|
||||
^ 27
|
||||
]
|
||||
|
||||
{ #category : #generated }
|
||||
CarpScanner >> scan1 [
|
||||
[ self step.
|
||||
currentCharacter == $"
|
||||
ifTrue: [ ^ self recordAndReportMatch: #(1) ].
|
||||
currentCharacter == $\
|
||||
ifTrue: [ self step.
|
||||
(currentCharacter <= Character tab
|
||||
or: [ (currentCharacter between: Character pageUp and: Character newPage)
|
||||
or: [ currentCharacter >= (Character value: 14) ] ])
|
||||
ifTrue: [ ^ self scan2 ].
|
||||
^ self reportLastMatch ].
|
||||
true ] whileTrue
|
||||
]
|
||||
|
||||
{ #category : #generated }
|
||||
CarpScanner >> scan2 [
|
||||
[ self step.
|
||||
currentCharacter == $"
|
||||
ifTrue: [ [ self recordMatch: #(1).
|
||||
self step.
|
||||
currentCharacter == $" ] whileTrue.
|
||||
(currentCharacter == Character lf
|
||||
or: [ currentCharacter == Character cr ])
|
||||
ifTrue: [ ^ self scan1 ].
|
||||
^ self scan2 ].
|
||||
(currentCharacter == Character lf
|
||||
or: [ currentCharacter == Character cr ])
|
||||
ifTrue: [ ^ self scan1 ].
|
||||
true ] whileTrue
|
||||
]
|
||||
|
||||
{ #category : #generated }
|
||||
CarpScanner >> scan3 [
|
||||
self step.
|
||||
currentCharacter isDigit
|
||||
ifTrue: [ [ self recordMatch: #(11).
|
||||
self step.
|
||||
currentCharacter == $f
|
||||
ifTrue: [ ^ self recordAndReportMatch: #(11) ].
|
||||
currentCharacter isDigit ] whileTrue ].
|
||||
^ self reportLastMatch
|
||||
]
|
||||
|
||||
{ #category : #generated }
|
||||
CarpScanner >> scan4 [
|
||||
[ self recordMatch: #(11).
|
||||
self step.
|
||||
currentCharacter == $.
|
||||
ifTrue: [ ^ self scan3 ].
|
||||
currentCharacter isDigit ] whileTrue.
|
||||
('bfl' includes: currentCharacter)
|
||||
ifTrue: [ ^ self recordAndReportMatch: #(11) ].
|
||||
^ self reportLastMatch
|
||||
]
|
||||
|
||||
{ #category : #generated }
|
||||
CarpScanner >> scanForToken [
|
||||
self step.
|
||||
currentCharacter == $"
|
||||
ifTrue: [ ^ self scan1 ].
|
||||
currentCharacter == $'
|
||||
ifTrue: [ ^ self recordAndReportMatch: #(4) ].
|
||||
currentCharacter == $(
|
||||
ifTrue: [ ^ self recordAndReportMatch: #(2) ].
|
||||
currentCharacter == $)
|
||||
ifTrue: [ ^ self recordAndReportMatch: #(3) ].
|
||||
currentCharacter == $.
|
||||
ifTrue: [ ^ self recordAndReportMatch: #(8) ].
|
||||
^ self scanForTokenX5
|
||||
]
|
||||
|
||||
{ #category : #generated }
|
||||
CarpScanner >> scanForTokenX1 [
|
||||
self recordMatch: #(11).
|
||||
self step.
|
||||
currentCharacter == $.
|
||||
ifTrue: [ ^ self scan3 ].
|
||||
currentCharacter == $b
|
||||
ifTrue: [ self recordMatch: #(11).
|
||||
self step.
|
||||
(currentCharacter between: $0 and: $1)
|
||||
ifTrue: [ ^ self recordAndReportMatch: #(11) ].
|
||||
^ self reportLastMatch ].
|
||||
currentCharacter == $x
|
||||
ifTrue: [ self step.
|
||||
(currentCharacter isDigit
|
||||
or: [ (currentCharacter between: $A and: $F)
|
||||
or: [ currentCharacter between: $a and: $f ] ])
|
||||
ifTrue: [ ^ self recordAndReportMatch: #(11) ].
|
||||
^ self reportLastMatch ].
|
||||
currentCharacter isDigit
|
||||
ifTrue: [ ^ self scan4 ].
|
||||
('fl' includes: currentCharacter)
|
||||
ifTrue: [ ^ self recordAndReportMatch: #(11) ].
|
||||
^ self reportLastMatch
|
||||
]
|
||||
|
||||
{ #category : #generated }
|
||||
CarpScanner >> scanForTokenX2 [
|
||||
[ self recordMatch: #(6).
|
||||
self step.
|
||||
currentCharacter isLowercase
|
||||
or: [ currentCharacter isDigit
|
||||
or: [ ('!$' includes: currentCharacter)
|
||||
or: [ (currentCharacter between: $* and: $+)
|
||||
or: [ ('/:' includes: currentCharacter)
|
||||
or: [ (currentCharacter between: $< and: $?)
|
||||
or: [ currentCharacter == $_ ] ] ] ] ] ] ] whileTrue.
|
||||
^ self reportLastMatch
|
||||
]
|
||||
|
||||
{ #category : #generated }
|
||||
CarpScanner >> scanForTokenX3 [
|
||||
[ self recordMatch: #(5).
|
||||
self step.
|
||||
currentCharacter isLowercase
|
||||
or: [ currentCharacter isDigit
|
||||
or: [ ('!$' includes: currentCharacter)
|
||||
or: [ (currentCharacter between: $* and: $+)
|
||||
or: [ ('/:' includes: currentCharacter)
|
||||
or: [ (currentCharacter between: $< and: $?)
|
||||
or: [ currentCharacter == $_ ] ] ] ] ] ] ] whileTrue
|
||||
]
|
||||
|
||||
{ #category : #generated }
|
||||
CarpScanner >> scanForTokenX4 [
|
||||
[ self recordMatch: #(7).
|
||||
self step.
|
||||
currentCharacter isSpaceSeparator or: [ currentCharacter == $, ] ]
|
||||
whileTrue.
|
||||
^ self reportLastMatch
|
||||
]
|
||||
|
||||
{ #category : #generated }
|
||||
CarpScanner >> scanForTokenX5 [
|
||||
currentCharacter == $0
|
||||
ifTrue:
|
||||
[ ^ self scanForTokenX1 ].
|
||||
currentCharacter == $[
|
||||
ifTrue: [ ^ self recordAndReportMatch: #(9) ].
|
||||
currentCharacter == $]
|
||||
ifTrue: [ ^ self recordAndReportMatch: #(10) ].
|
||||
currentCharacter isDigit
|
||||
ifTrue: [ ^ self scan4 ].
|
||||
(currentCharacter isSpaceSeparator or: [ currentCharacter == $, ])
|
||||
ifTrue:
|
||||
[ ^ self scanForTokenX4 ].
|
||||
currentCharacter isUppercase
|
||||
ifTrue:
|
||||
[ ^ self scanForTokenX2 ].
|
||||
(currentCharacter isLowercase
|
||||
or: [ ('!$' includes: currentCharacter)
|
||||
or: [ (currentCharacter between: $* and: $+)
|
||||
or: [ ('/:' includes: currentCharacter)
|
||||
or: [ (currentCharacter between: $< and: $?)
|
||||
or: [ currentCharacter == $_ ] ] ] ] ])
|
||||
ifTrue:
|
||||
[ self scanForTokenX3 ].
|
||||
^ self reportLastMatch
|
||||
]
|
1
src/Carp/package.st
Normal file
1
src/Carp/package.st
Normal file
@@ -0,0 +1 @@
|
||||
Package { #name : #Carp }
|
Reference in New Issue
Block a user