islands/JavaParser.st
author Patrik Svestka <patrik.svestka@gmail.com>
Wed, 14 Nov 2018 13:01:14 +0100
changeset 642 77d5fddb6462
parent 454 a9cd5ea7cc36
permissions -rw-r--r--
Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present - All source *.st files are now Unicode UTF8 without BOM Files are in two groups (fileOut works this way in Smalltalk/X): - containing a unicode character have "{ Encoding: utf8 }" at the header - ASCII only are without the header
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
387
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     1
"{ Package: 'stx:goodies/petitparser/islands' }"
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     2
454
a9cd5ea7cc36 Portability: fixes for Smalltalk/X
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 387
diff changeset
     3
"{ NameSpace: Smalltalk }"
a9cd5ea7cc36 Portability: fixes for Smalltalk/X
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 387
diff changeset
     4
387
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     5
PPCompositeParser subclass:#JavaParser
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     6
	instanceVariableNames:'javaClass classDef classBody methodDef arguments methodBody
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     7
		methodName block modifiers classId type throws javaClassIsland
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     8
		methodModifiers semicolon comment singleLineComment string water'
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     9
	classVariableNames:''
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    10
	poolDictionaries:''
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    11
	category:'PetitIslands-Examples'
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    12
!
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    13
642
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    14
JavaParser comment:'A JavaParser is a island parser, that can extract method names from a java file.
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    15
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    16
Instance Variables
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    17
	arguments:		<Object>
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    18
	block:		<Object>
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    19
	classBody:		<Object>
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    20
	classDef:		<Object>
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    21
	classId:		<Object>
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    22
	javaClass:		<Object>
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    23
	javaClassIsland:		<Object>
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    24
	methodBody:		<Object>
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    25
	methodDef:		<Object>
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    26
	methodModifiers:		<Object>
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    27
	methodName:		<Object>
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    28
	modifiers:		<Object>
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    29
	semicolon:		<Object>
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    30
	throws:		<Object>
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    31
	type:		<Object>
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    32
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    33
arguments
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    34
	- xxxxx
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    35
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    36
block
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    37
	- xxxxx
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    38
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    39
classBody
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    40
	- xxxxx
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    41
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    42
classDef
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    43
	- xxxxx
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    44
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    45
classId
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    46
	- xxxxx
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    47
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    48
javaClass
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    49
	- xxxxx
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    50
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    51
javaClassIsland
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    52
	- xxxxx
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    53
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    54
methodBody
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    55
	- xxxxx
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    56
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    57
methodDef
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    58
	- xxxxx
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    59
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    60
methodModifiers
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    61
	- xxxxx
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    62
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    63
methodName
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    64
	- xxxxx
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    65
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    66
modifiers
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    67
	- xxxxx
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    68
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    69
semicolon
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    70
	- xxxxx
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    71
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    72
throws
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    73
	- xxxxx
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    74
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    75
type
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    76
	- xxxxx
77d5fddb6462 Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents: 454
diff changeset
    77
'
387
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    78
!
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    79
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    80
!JavaParser methodsFor:'as yet unclassified'!
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    81
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    82
start
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    83
	^ javaClassIsland
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    84
! !
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    85
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    86
!JavaParser methodsFor:'class'!
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    87
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    88
block
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    89
	^ (${ asParser,
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    90
		((block island: water) plus / nil asParser island),
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    91
	$} asParser) ==> [:tokens | nil ]
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    92
		
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    93
!
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    94
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    95
classBody
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    96
	 ^ 
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    97
	(${ asParser,
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    98
		(
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    99
		((methodDef island: water) ==> [:tokens | tokens second]) plus /
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   100
		((nil asParser island: water) ==> [ :tokens | OrderedCollection new ])
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   101
		),
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   102
	$} asParser) ==> [:tokens | tokens second select: [:e | e isNil not ]]
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   103
!
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   104
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   105
classDef
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   106
	^ modifiers trim, 'class' asParser, classId trim ==> [:tokens | tokens third ]
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   107
!
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   108
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   109
classId
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   110
	^ (#uppercase asParser, (#letter asParser / #digit asParser) star) flatten 
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   111
!
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   112
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   113
javaClass
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   114
	^ classDef, ((classBody island:water) ==> [:tokens | tokens second ])
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   115
!
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   116
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   117
javaClassIsland
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   118
	^ (javaClass island: water) ==> [:tokens | tokens second]
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   119
!
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   120
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   121
methodModifiers
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   122
	^( ('public' asParser / 'private' asParser / 'protected' asParser) optional, 
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   123
	  'static' asParser trim optional, 
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   124
	  'final' asParser trim optional,
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   125
	  'abstract' asParser trim optional,
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   126
	  'synchronized' asParser trim optional,	
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   127
	  'native' asParser trim optional) ==> [ :tokens | nil ]
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   128
!
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   129
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   130
modifiers
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   131
	^ ('public' asParser / 'private' asParser), 'final' asParser trim optional, 'abstract' asParser trim optional
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   132
! !
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   133
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   134
!JavaParser methodsFor:'comments and strings'!
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   135
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   136
comment
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   137
	| end |
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   138
	end := '*/' asParser.
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   139
	^ ('/*' asParser, (#any asParser starLazy: end), end)
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   140
!
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   141
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   142
singleLineComment
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   143
	| end |
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   144
	end := #newline asParser.
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   145
	^ ('//' asParser, (#any asParser starLazy: end), end)
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   146
!
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   147
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   148
string
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   149
	| end |
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   150
	end := $" asParser.
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   151
	^ ($" asParser, (#any asParser starLazy: end), end)
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   152
		name: 'string';
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   153
		yourself.
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   154
! !
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   155
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   156
!JavaParser methodsFor:'context'!
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   157
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   158
updateContext: aPPContext
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   159
	super updateContext: aPPContext.
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   160
"	aPPContext globalAt: #waterObjects put: (OrderedCollection 
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   161
			with: self comment 
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   162
			with: self singleLineComment
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   163
			with: self string
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   164
			with: self block)."
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   165
! !
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   166
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   167
!JavaParser methodsFor:'method'!
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   168
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   169
arguments
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   170
	^ $( asParser, nil asParser island,  $) asParser trim
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   171
!
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   172
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   173
methodBody 
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   174
	^ semicolon / block
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   175
!
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   176
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   177
methodDef
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   178
	^ methodModifiers, (type island: water), (methodName island:water), (arguments island:water), methodBody ==> [:tokens | tokens third second ]
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   179
!
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   180
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   181
methodName
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   182
	^ (#letter asParser, (#letter asParser / #digit asParser) star) flatten 
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   183
!
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   184
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   185
semicolon
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   186
	^ ';' asParser
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   187
!
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   188
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   189
throws
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   190
	^ 'throws' asParser trim, type trim, ($, asParser, type trim) star
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   191
!
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   192
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   193
type
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   194
	^ (#letter asParser, (#letter asParser / #digit asParser) star) flatten 
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   195
!
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   196
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   197
water
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   198
	"
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   199
		This will allow to skip over
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   200
			- Strings, 
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   201
			- Comments 
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   202
			- and blocks 
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   203
		when parsing water. This way, comments and strings cannot confuse the result.
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   204
	"
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   205
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   206
	^ comment / string / singleLineComment / block / #any asParser
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   207
! !
e2b2ccaa4de6 Commited a island parser support (MC package PetitIslands)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   208