'From Pharo1.4 of 18 April 2012 [Latest update: #14457] on 26 December 2012 at
10:58:18 am'!
PPCompositeParser subclass: #LEImportSKMPowerTools
instanceVariableNames: 'endOfLine nonComma start tableName columnNames columnName
columnNamesRow table dataCell dataRow dataRows'
classVariableNames: ''
poolDictionaries: ''
category: 'Lektrek-ImportExport'!
!LEImportSKMPowerTools methodsFor: 'as yet unclassified' stamp: 'BenComan
12/24/2012 15:23'!
dataCell
^ nonComma star flatten
==> [ :nodes | nodes value ]! !
!LEImportSKMPowerTools methodsFor: 'as yet unclassified' stamp: 'BenComan
12/24/2012 19:37'!
dataRows
^ (dataRow delimitedBy: endOfLine) ==> [ :nodes | nodes reject: [ :each | each class
= PPToken ] ]! !
!LEImportSKMPowerTools methodsFor: 'as yet unclassified' stamp: 'BenComan
12/24/2012 12:18'!
endOfLine
^ #newline asParser token! !
!LEImportSKMPowerTools methodsFor: 'as yet unclassified' stamp: 'BenComan
12/24/2012 12:23'!
nonComma
^ PPPredicateObjectParser anyExceptAnyOf: {Character tab . Character cr . Character lf .
$, }! !
!LEImportSKMPowerTools methodsFor: 'grammar' stamp: 'BenComan 12/24/2012
15:38'!
columnName
^ $< asParser , (#letter asParser / #digit asParser / #space asParser / $_ asParser /
$/ asParser ) star flatten , $> asParser
==> [ :nodes | nodes second value ]! !
!LEImportSKMPowerTools methodsFor: 'grammar' stamp: 'BenComan 12/24/2012
14:54'!
columnNames
^ ((columnName delimitedBy: $, asParser token) ) ==> [ :nodes | nodes reject: [ :each
| each class = PPToken ] ]! !
!LEImportSKMPowerTools methodsFor: 'grammar' stamp: 'BenComan 12/24/2012
14:56'!
columnNamesRow
^ '//' asParser, columnNames
==> [ :nodes | nodes second value ]! !
!LEImportSKMPowerTools methodsFor: 'grammar' stamp: 'BenComan 12/24/2012
15:23'!
dataRow
^ (dataCell delimitedBy: $, asParser token) ==> [ :nodes | nodes reject: [ :each |
each class = PPToken ] ]! !
!LEImportSKMPowerTools methodsFor: 'grammar' stamp: 'BenComan 12/26/2012
10:30'!
start
^ table star end! !
!LEImportSKMPowerTools methodsFor: 'grammar' stamp: 'BenComan 12/26/2012
10:38'!
table
^ ( (tableName , endOfLine, columnNamesRow , endOfLine , dataRows)
==> [ :nodes | { nodes first . nodes third . nodes fifth } ] )! !
!LEImportSKMPowerTools methodsFor: 'grammar' stamp: 'BenComan 12/24/2012
14:24'!
tableName
^ '// --- ' asParser, #word asParser star flatten, ' ---' asParser
==> [ :nodes | nodes second value ]! !
PPCompositeParser subclass: #LEImportSKMPowerTools
instanceVariableNames: 'endOfLine nonComma start table tableName columnNamesRow
columnNames columnName dataRows dataRow dataCell'
LEImportSKMPowerTools>>start
^ table star end
LEImportSKMPowerTools>>table
^ ( (tableName , endOfLine, columnNamesRow , endOfLine , dataRows)
==> [ :nodes | { nodes first . nodes third . nodes fifth } ] )
LEImportSKMPowerTools>>tableName
^ '// --- ' asParser, #word asParser star flatten, ' ---' asParser
==> [ :nodes | nodes second value ]
LEImportSKMPowerTools>>columnNamesRow
^ '//' asParser, columnNames
==> [ :nodes | nodes second value ]
LEImportSKMPowerTools>>columnNames
^ ((columnName delimitedBy: $, asParser token) )
==> [ :nodes | nodes reject: [ :each | each class = PPToken ] ]
LEImportSKMPowerTools>>columnName
^ $< asParser , (#letter asParser / #digit asParser / #space asParser / $_ asParser /
$/ asParser ) star flatten , $> asParser
==> [ :nodes | nodes second value ]
LEImportSKMPowerTools>>dataRows
^ (dataRow delimitedBy: endOfLine)
==> [ :nodes | nodes reject: [ :each | each class = PPToken ] ]
LEImportSKMPowerTools>>dataRow
^ (dataCell delimitedBy: $, asParser token)
==> [ :nodes | nodes reject: [ :each | each class = PPToken ] ]
LEImportSKMPowerTools>>dataCell
^ nonComma star flatten
==> [ :nodes | nodes value ]
LEImportSKMPowerTools>>endOfLine
^ #newline asParser token
LEImportSKMPowerTools>>nonComma
^ PPPredicateObjectParser anyExceptAnyOf: {Character tab . Character cr . Character lf .
$, }
// Export start : 12/18/12 18:18:07
// Datablock format : All Input Data
// Query name : *ALL COMPONENTS
// --- Bus ---
//<ComponentName>,<ComponentType>,<SystemNominalVoltage>,<AF_ArcType>,<AF_WorkingDistance>
00BFA10,10,415,In Box,609.6
00BFA20,10,415,In Box,609.6
// The following field(s) are enumerated data types
// Either the quoted text or integer may be used in importing
// <InService>: "Out"=0 "In"=1
// <Phase>: "None"=0 "A"=1 "B"=2 "C"=4
"AB"=3 "AC"=5 "BC"=6 "ABC"=7 "AB
MidTap"=48 "BC MidTap"=96 "CA MidTap"=80 "ABC
MidTap"=112
// <Size/Do Not Size>: "Size"=0 "Do Not Size"=1
// --- Cable ---
//<ComponentName>,<SystemNominalVoltage>,<Phase>,<CableSize>,<NeutralSize>,<Length>,<Size/Do
Not Size>
11P08023,11500,ABC,240,,680.0,Do Not Size
11P08024,11500,ABC,240,,610.0,Do Not Size