ParseError.st
author Claus Gittinger <cg@exept.de>
Mon, 11 May 2015 15:20:01 +0200
changeset 3628 febf865a3ca9
parent 3064 179c907e32be
child 4035 7b356dc3e0c2
permissions -rw-r--r--
class: Structure changed: #initializeOneInstance also understands #respondsTo:
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3064
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
     1
"
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
     2
 COPYRIGHT (c) 1989 by Claus Gittinger
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
     3
              All Rights Reserved
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
     4
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
     5
 This software is furnished under a license and may be used
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
     6
 only in accordance with the terms of that license and with the
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
     8
 be provided or otherwise made available to, or used by, any
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
     9
 other person.  No title to or ownership of the software is
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    10
 hereby transferred.
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    11
"
3062
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
"{ Package: 'stx:libcomp' }"
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
3064
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    14
ProceedableError subclass:#ParseError
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    15
	instanceVariableNames:'errorMessage startPosition endPosition lineNumber'
3062
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
	classVariableNames:''
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	poolDictionaries:''
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	category:'System-Compiler'
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
!
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
3064
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    21
!ParseError class methodsFor:'documentation'!
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    22
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    23
copyright
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    24
"
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    25
 COPYRIGHT (c) 1989 by Claus Gittinger
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    26
              All Rights Reserved
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    27
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    28
 This software is furnished under a license and may be used
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    29
 only in accordance with the terms of that license and with the
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    30
 inclusion of the above copyright notice.   This software may not
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    31
 be provided or otherwise made available to, or used by, any
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    32
 other person.  No title to or ownership of the software is
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    33
 hereby transferred.
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    34
"
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    35
!
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    36
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    37
documentation
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    38
"
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    39
    raised for any compilation-related errors.
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    40
    (originally, I wanted to subclass this from compilationError,
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    41
    and raise different error for code generator issues (i.e. method too
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    42
    big, etc.) But all users of the parser in the system (RB-stuff, Lint stuff,
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    43
    fileIn etc.) always handle the ParseError, and I dont want them to be forced to change.
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    44
    So we subclass the codeGenerator issues from this one.
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    45
"
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    46
! !
3062
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
!ParseError methodsFor:'accessing'!
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
description
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
    |s|
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
    s := super description.
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
    s last isSeparator ifFalse:[
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
        errorMessage notEmptyOrNil ifTrue:[
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
            s := s , ' '
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
        ]
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
    ].
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
    s := s , (errorMessage ? '').
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
    lineNumber notNil ifTrue:[
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
        s := s , ' [Line ' , lineNumber asString , ']'
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
    ].
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
    ^ s
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
!
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
endPosition
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
    ^ endPosition
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
!
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
3064
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    70
errorMessage
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    71
    ^ errorMessage
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    72
!
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    73
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    74
errorMessage:something
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    75
    errorMessage := something.
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    76
!
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    77
3062
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
errorMessage:errorMessageArg startPosition:startPositionArg 
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
    errorMessage := errorMessageArg.
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
    startPosition := startPositionArg.
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
!
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
errorMessage:errorMessageArg startPosition:startPositionArg endPosition:endPositionArg 
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
    errorMessage := errorMessageArg.
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
    startPosition := startPositionArg.
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
    endPosition := endPositionArg.
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
!
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
lineNumber
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
    ^ lineNumber
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
!
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
lineNumber:something
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
    lineNumber := something.
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
!
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
parser
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
    ^ originator
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
!
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
startPosition
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
    ^ startPosition
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
! !
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
!ParseError class methodsFor:'documentation'!
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
version
3064
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
   108
    ^ '$Header: /cvs/stx/stx/libcomp/ParseError.st,v 1.2 2013-04-03 17:21:30 cg Exp $'
3062
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
!
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
version_CVS
3064
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
   112
    ^ '$Header: /cvs/stx/stx/libcomp/ParseError.st,v 1.2 2013-04-03 17:21:30 cg Exp $'
3062
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
! !
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114