~sjm/gt-jenga

1054beba289d81975cfbca0889a0c04f26b0a20d — Sam Marshall 3 months ago 6d8b0cc
add TagTimeParser
A src/SjmJenga/SjmTagTimeLineNode.class.st => src/SjmJenga/SjmTagTimeLineNode.class.st +11 -0
@@ 0,0 1,11 @@
Class {
	#name : #SjmTagTimeLineNode,
	#superclass : #SjmTagTimeStartNode,
	#category : #'SjmJenga-tag-time'
}

{ #category : #generated }
SjmTagTimeLineNode >> acceptVisitor: aStartVisitor [

	^ aStartVisitor visitLine: self
]

M src/SjmJenga/SjmTagTimeLogParser.class.st => src/SjmJenga/SjmTagTimeLogParser.class.st +58 -39
@@ 6,39 6,41 @@ Class {

{ #category : #'generated-accessing' }
SjmTagTimeLogParser class >> cacheId [
	^'2022-03-22T18:23:44.894009+00:00'
	^'2022-03-22T20:07:16.185866+00:00'
]

{ #category : #generated }
SjmTagTimeLogParser class >> definitionComment [
"<timestamp>
"%root Program;
%prefix SjmTagTime;
%suffix Node;<timestamp>
	: [0-9]+
	;
<whitespace>
	: \s+
	;
<tag>
	: [a-zA-Z]+(\- [a-zA-Z]+)*
	: [a-zA-Z0-9:""]+(\- [a-zA-Z0-9:""]+)*
	;
<redundantDate>
	: \[ <isCharacter>+ \]
<redundantData>
	: \[ ([^\]])+ \]
	;
<eol>
	: \n
	;Start 
	: TagLine +
Start 
	: TagLine 'line'
	| Start TagLine 'line' 
	;
Tag
	: <tag>
	: <tag> 
	;
TagList
	: Tag +
	: Tag  +
	;
TagLine
	: Timestamp TagList RedundantData <eol>
	: Timestamp 'timestamp' TagList'tags' RedundantData  'redundant' +
	| Timestamp 'timestamp' RedundantData 'redundant' +
	;
RedundantData
	: <redundantDate>
	: <redundantData>
	;
Timestamp
	: <timestamp>


@@ 48,16 50,20 @@ Timestamp
{ #category : #generated }
SjmTagTimeLogParser class >> reduceTable [
^#(
	#(14 1 #reduceFor: 296961 false) 
	#(7 1 #reduceFor: 146433 false) 
	#(8 1 #reduceFor: 156673 false) 
	#(8 2 #reduceFor: 156674 false) 
	#(9 1 #reduceFor: 169985 false) 
	#(11 1 #reduceFor: 197633 false) 
	#(10 1 #reduceFor: 186369 false) 
	#(13 1 #reduceFor: 260097 false) 
	#(11 2 #reduceFor: 197634 false) 
	#(12 4 #reduceFor: 206849 false)
	#(14 1 #liftFirstValue: 451585 false) 
	#(6 1 #liftFirstValue: 186369 false) 
	#(6 2 #liftFirstValue: 186370 false) 
	#(7 1 #liftFirstValue: 240641 false) 
	#(13 1 #liftFirstValue: 414721 false) 
	#(9 1 #liftFirstValue: 269313 false) 
	#(8 1 #liftFirstValue: 258049 false) 
	#(10 2 #liftFirstValue: 279554 false) 
	#(12 1 #liftFirstValue: 382977 false) 
	#(10 3 #liftFirstValue: 279553 false) 
	#(11 1 #liftFirstValue: 327681 false) 
	#(9 2 #liftFirstValue: 269314 false) 
	#(12 2 #liftFirstValue: 382978 false) 
	#(11 2 #liftFirstValue: 327682 false)
	).
]



@@ 75,28 81,41 @@ SjmTagTimeLogParser class >> startingStateForStart [
{ #category : #generated }
SjmTagTimeLogParser class >> symbolNames [

	^ #( '<timestamp>' '<whitespace>' '<tag>' '<redundantDate>'
	     '<eol>' 'B e g i n' 'Start' 'TagLine +' 'Tag' 'TagList'
	     'Tag +' 'TagLine' 'RedundantData' 'Timestamp' 'E O F' 'error' )
	^ #( '<timestamp>' '<whitespace>' '<tag>' '<redundantData>'
	     'B e g i n' 'Start' 'Tag' 'TagList' 'Tag  +' 'TagLine' 'RedundantData  ''redundant'' +'
	     'RedundantData ''redundant'' +' 'RedundantData' 'Timestamp'
	     'E O F' 'error' )
]

{ #category : #generated }
SjmTagTimeLogParser class >> symbolTypes [

	^ #( #SmaCCToken #SmaCCToken #SmaCCToken #SmaCCToken #SmaCCToken
	     #SmaCCToken #SmaCCToken #SmaCCToken #SmaCCToken #SmaCCToken
	     #SmaCCToken #SmaCCToken #SmaCCToken #SmaCCToken #SmaCCToken
	     #SmaCCErrorNode )
]

{ #category : #generated }
SjmTagTimeLogParser class >> transitionTable [
^#(
#[1 0 9 0 1 0 13 0 7 0 17 0 8 0 21 0 12 0 25 0 14] 
#[0 0 6 0 3] 
#[0 0 0 0 15] 
#[1 0 9 0 1 0 29 0 12 0 25 0 14 0 10 0 15] 
#[1 0 21 0 1 0 13 0 6 0 13 0 10 0 21 0 14] 
#[0 0 6 0 3 0 4] 
#[1 0 21 0 1 0 25 0 10 0 21 0 14 0 0 0 15] 
#[0 0 10 0 1 0 15] 
#[1 0 45 0 3 0 49 0 4 0 45 0 7 0 41 0 8 0 45 0 9 0 49 0 12 0 49 0 13] 
#[0 0 14 0 1 0 15] 
#[1 0 33 0 3 0 37 0 9 0 41 0 10 0 45 0 11] 
#[0 0 18 0 1 0 15] 
#[0 0 22 0 3 0 4] 
#[0 0 18 0 3 0 4] 
#[0 0 22 0 1 0 4 0 15] 
#[0 0 26 0 3 0 4] 
#[1 0 49 0 4 0 53 0 13] 
#[1 0 33 0 3 0 30 0 4 0 57 0 9] 
#[0 0 34 0 5] 
#[0 0 61 0 5] 
#[0 0 38 0 3 0 4] 
#[0 0 42 0 1 0 15]
#[0 0 57 0 4 0 11 0 13] 
#[1 0 65 0 3 0 30 0 4 0 65 0 7] 
#[1 0 34 0 1 0 69 0 4 0 69 0 13 0 34 0 15] 
#[0 0 38 0 1 0 4 0 15] 
#[1 0 42 0 1 0 73 0 4 0 73 0 13 0 42 0 15] 
#[0 0 46 0 1 0 4 0 15] 
#[0 0 50 0 3 0 4] 
#[0 0 54 0 1 0 4 0 15] 
#[0 0 58 0 1 0 4 0 15]
	).
]

M src/SjmJenga/SjmTagTimeLogScanner.class.st => src/SjmJenga/SjmTagTimeLogScanner.class.st +26 -29
@@ 22,63 22,60 @@ SjmTagTimeLogScanner >> scan1 [
	[ 
	self recordMatch: #( 3 ).
	self step.
	currentCharacter == $- ifTrue: [ 
		self step.
		((currentCharacter between: $A and: $Z) or: [ 
			 currentCharacter between: $a and: $z ]) ifTrue: [ ^ self scan1 ].
		^ self reportLastMatch ].
	(currentCharacter between: $A and: $Z) or: [ 
		currentCharacter between: $a and: $z ] ] whileTrue.
	currentCharacter == $- ifTrue: [ ^ self scan2 ].
	currentCharacter == $" or: [ 
		(currentCharacter between: $0 and: $:) or: [ 
			(currentCharacter between: $A and: $Z) or: [ 
				currentCharacter between: $a and: $z ] ] ] ] whileTrue.
	^ self reportLastMatch
]

{ #category : #generated }
SjmTagTimeLogScanner >> scan2 [

	[ 
	self step.
	currentCharacter == $] ifTrue: [ 
		[ 
		self recordMatch: #( 4 ).
		self step.
		currentCharacter == $] ] whileTrue.
		^ self scan2 ].
	true ] whileTrue
	(currentCharacter == $" or: [ 
		 (currentCharacter between: $0 and: $:) or: [ 
			 (currentCharacter between: $A and: $Z) or: [ 
				 currentCharacter between: $a and: $z ] ] ]) ifTrue: [ 
		^ self scan1 ].
	^ self reportLastMatch
]

{ #category : #generated }
SjmTagTimeLogScanner >> scanForToken [

	self step.
	currentCharacter == Character lf ifTrue: [ 
		self recordMatch: #( 2 5 ).
	currentCharacter == $[ ifTrue: [ 
		self step.
		(currentCharacter isSeparator or: [ 
			 currentCharacter == Character pageUp ]) ifTrue: [ 
		currentCharacter ~~ $] ifTrue: [ 
			[ 
			self recordMatch: #( 2 ).
			self step.
			currentCharacter isSeparator or: [ 
				currentCharacter == Character pageUp ] ] whileTrue ].
			currentCharacter == $] ifTrue: [ 
				^ self recordAndReportMatch: #( 4 ) ].
			true ] whileTrue ].
		^ self reportLastMatch ].
	currentCharacter == $[ ifTrue: [ 
		self step.
		^ self scan2 ].
	currentCharacter isDigit ifTrue: [ 
		[ 
		self recordMatch: #( 1 ).
		self recordMatch: #( 1 3 ).
		self step.
		currentCharacter == $- ifTrue: [ ^ self scan2 ].
		currentCharacter isDigit ] whileTrue.
		(('":' includes: currentCharacter) or: [ 
			 (currentCharacter between: $A and: $Z) or: [ 
				 currentCharacter between: $a and: $z ] ]) ifTrue: [ ^ self scan1 ].
		^ self reportLastMatch ].
	((currentCharacter between: $A and: $Z) or: [ 
		 currentCharacter between: $a and: $z ]) ifTrue: [ ^ self scan1 ].
	(currentCharacter isSeparator or: [ 
		 currentCharacter == Character pageUp ]) ifTrue: [ 
		[ 
		self recordMatch: #( 2 ).
		self step.
		currentCharacter isSeparator or: [ 
			currentCharacter == Character pageUp ] ] whileTrue ].
			currentCharacter == Character pageUp ] ] whileTrue.
		^ self reportLastMatch ].
	(('":' includes: currentCharacter) or: [ 
		 (currentCharacter between: $A and: $Z) or: [ 
			 currentCharacter between: $a and: $z ] ]) ifTrue: [ ^ self scan1 ].
	^ self reportLastMatch
]


A src/SjmJenga/SjmTagTimeProgramNode.class.st => src/SjmJenga/SjmTagTimeProgramNode.class.st +11 -0
@@ 0,0 1,11 @@
Class {
	#name : #SjmTagTimeProgramNode,
	#superclass : #SmaCCParseNode,
	#category : #'SjmJenga-tag-time'
}

{ #category : #generated }
SjmTagTimeProgramNode >> acceptVisitor: aProgramVisitor [

	^ aProgramVisitor visitProgram: self
]

A src/SjmJenga/SjmTagTimeProgramNodeVisitor.class.st => src/SjmJenga/SjmTagTimeProgramNodeVisitor.class.st +7 -0
@@ 0,0 1,7 @@
Class {
	#name : #SjmTagTimeProgramNodeVisitor,
	#superclass : #Object,
	#traits : 'TSjmTagTimeProgramNodeVisitor',
	#classTraits : 'TSjmTagTimeProgramNodeVisitor classTrait',
	#category : #'SjmJenga-tag-time'
}

A src/SjmJenga/SjmTagTimeStartNode.class.st => src/SjmJenga/SjmTagTimeStartNode.class.st +11 -0
@@ 0,0 1,11 @@
Class {
	#name : #SjmTagTimeStartNode,
	#superclass : #SmaCCParseNode,
	#category : #'SjmJenga-tag-time'
}

{ #category : #generated }
SjmTagTimeStartNode >> acceptVisitor: aStartVisitor [

	^ aStartVisitor visitStart: self
]

A src/SjmJenga/SjmTagTimeStartNodeVisitor.class.st => src/SjmJenga/SjmTagTimeStartNodeVisitor.class.st +7 -0
@@ 0,0 1,7 @@
Class {
	#name : #SjmTagTimeStartNodeVisitor,
	#superclass : #Object,
	#traits : 'TSjmTagTimeStartNodeVisitor',
	#classTraits : 'TSjmTagTimeStartNodeVisitor classTrait',
	#category : #'SjmJenga-tag-time'
}

A src/SjmJenga/SjmTagTimeTagNode.class.st => src/SjmJenga/SjmTagTimeTagNode.class.st +11 -0
@@ 0,0 1,11 @@
Class {
	#name : #SjmTagTimeTagNode,
	#superclass : #SjmTagTimeStartNode,
	#category : #'SjmJenga-tag-time'
}

{ #category : #generated }
SjmTagTimeTagNode >> acceptVisitor: aStartVisitor [

	^ aStartVisitor visitTag: self
]

A src/SjmJenga/SjmTagTimeTimestampNode.class.st => src/SjmJenga/SjmTagTimeTimestampNode.class.st +11 -0
@@ 0,0 1,11 @@
Class {
	#name : #SjmTagTimeTimestampNode,
	#superclass : #SjmTagTimeStartNode,
	#category : #'SjmJenga-tag-time'
}

{ #category : #generated }
SjmTagTimeTimestampNode >> acceptVisitor: aStartVisitor [

	^ aStartVisitor visitTimestamp: self
]

A src/SjmJenga/TSjmTagTimeProgramNodeVisitor.trait.st => src/SjmJenga/TSjmTagTimeProgramNodeVisitor.trait.st +12 -0
@@ 0,0 1,12 @@
Trait {
	#name : #TSjmTagTimeProgramNodeVisitor,
	#traits : 'TSmaCCParseNodeVisitor',
	#classTraits : 'TSmaCCParseNodeVisitor classTrait',
	#category : #'SjmJenga-tag-time'
}

{ #category : #generated }
TSjmTagTimeProgramNodeVisitor >> visitProgram: aProgram [

	^ self visitSmaCCParseNode: aProgram
]

A src/SjmJenga/TSjmTagTimeStartNodeVisitor.trait.st => src/SjmJenga/TSjmTagTimeStartNodeVisitor.trait.st +12 -0
@@ 0,0 1,12 @@
Trait {
	#name : #TSjmTagTimeStartNodeVisitor,
	#traits : 'TSmaCCParseNodeVisitor',
	#classTraits : 'TSmaCCParseNodeVisitor classTrait',
	#category : #'SjmJenga-tag-time'
}

{ #category : #generated }
TSjmTagTimeStartNodeVisitor >> visitStart: aStart [

	^ self visitSmaCCParseNode: aStart
]