ParseError.st
author Stefan Vogel <sv@exept.de>
Mon, 12 Dec 2016 16:38:47 +0100
changeset 4080 08869106d07e
parent 4035 7b356dc3e0c2
child 4261 1b91b0f56a54
permissions -rw-r--r--
#BUGFIX by stefan class: Parser comment/format in: #checkSelector:for:inClass: changed: #selectorCheck:for:positions: avoid symbol creation better message if method selector is totally unknown
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
4035
7b356dc3e0c2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3064
diff changeset
    14
"{ NameSpace: Smalltalk }"
7b356dc3e0c2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3064
diff changeset
    15
3064
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    16
ProceedableError subclass:#ParseError
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    17
	instanceVariableNames:'errorMessage startPosition endPosition lineNumber'
3062
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	classVariableNames:''
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	poolDictionaries:''
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
	category:'System-Compiler'
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
!
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
3064
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    23
!ParseError class methodsFor:'documentation'!
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
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    26
"
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    27
 COPYRIGHT (c) 1989 by Claus Gittinger
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    28
              All Rights Reserved
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    29
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    30
 This software is furnished under a license and may be used
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    31
 only in accordance with the terms of that license and with the
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    33
 be provided or otherwise made available to, or used by, any
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    34
 other person.  No title to or ownership of the software is
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    35
 hereby transferred.
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
!
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
documentation
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    40
"
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    41
    raised for any compilation-related errors.
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    42
    (originally, I wanted to subclass this from compilationError,
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    43
    and raise different error for code generator issues (i.e. method too
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    44
    big, etc.) But all users of the parser in the system (RB-stuff, Lint stuff,
4035
7b356dc3e0c2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3064
diff changeset
    45
    fileIn etc.) always handle the ParseError, and I don't want them to be forced to change.
3064
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    46
    So we subclass the codeGenerator issues from this one.
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    47
"
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    48
! !
3062
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
!ParseError methodsFor:'accessing'!
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
description
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
    |s|
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
    s := super description.
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
    s last isSeparator ifFalse:[
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
        errorMessage notEmptyOrNil ifTrue:[
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
            s := s , ' '
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
        ]
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
    ].
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
    s := s , (errorMessage ? '').
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
    lineNumber notNil ifTrue:[
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
        s := s , ' [Line ' , lineNumber asString , ']'
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
    ].
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
    ^ s
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
!
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
endPosition
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
    ^ endPosition
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
!
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
3064
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    72
errorMessage
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    73
    ^ errorMessage
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    74
!
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    75
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    76
errorMessage:something
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    77
    errorMessage := something.
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    78
!
179c907e32be class: ParseError
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
    79
3062
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
errorMessage:errorMessageArg startPosition:startPositionArg 
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
    errorMessage := errorMessageArg.
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
    startPosition := startPositionArg.
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
!
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
errorMessage:errorMessageArg startPosition:startPositionArg endPosition:endPositionArg 
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
    errorMessage := errorMessageArg.
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
    startPosition := startPositionArg.
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
    endPosition := endPositionArg.
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
!
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
lineNumber
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
    ^ lineNumber
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
!
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
lineNumber:something
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
    lineNumber := something.
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
!
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
parser
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
    ^ originator
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
!
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
startPosition
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
    ^ startPosition
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
! !
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
!ParseError class methodsFor:'documentation'!
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
version
4035
7b356dc3e0c2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3064
diff changeset
   110
    ^ '$Header$'
3062
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
!
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
version_CVS
4035
7b356dc3e0c2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3064
diff changeset
   114
    ^ '$Header$'
3062
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
! !
ab018dc93d8c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116