Skip to content

Commit

Permalink
Merge pull request #52 from hpi-swa-teaching/fix/weak-smalltalk-parse…
Browse files Browse the repository at this point in the history
…r-rebased

Fixed WeakSmalltalkParser and reenabled the disables tests for it
  • Loading branch information
martin-schilling committed Jun 13, 2020
2 parents 27e7a89 + 1e024cf commit 7ce897f
Show file tree
Hide file tree
Showing 13 changed files with 60 additions and 53 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest ]
smalltalk: [ Squeak64-5.3, Squeak64-5.2 ]
smalltalk: [ Squeak64-5.3 ]
experimental: [false]
include:
- smalltalk: Squeak64-trunk
Expand Down
14 changes: 0 additions & 14 deletions .travis.yml

This file was deleted.

3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# MarkdownEditor

[![CI][github_actions_badge]][github_actions_url]
[![Build Status][travis_badge]][travis_url]
[![Coverage Status][coveralls_badge]][coveralls_url]

**MarkdownEditor** is a tool enabling Squeak users to write Markdown in Squeak with highlighting. The Editor is designed to *focus on the Markdown you write*, no other distractions.
Expand Down Expand Up @@ -47,8 +46,6 @@ Developers: Felix Gohla, Kira Grammel, Clara Granzow, Maximilian Kleissl, Henok
When continuing this project, please feel free to add your names to the list. 😊

<!-- References -->
[travis_badge]: https://travis-ci.org/hpi-swa-teaching/MarkdownEditor.svg?branch=master
[travis_url]: https://travis-ci.org/hpi-swa-teaching/MarkdownEditor
[coveralls_badge]: https://coveralls.io/repos/github/hpi-swa-teaching/MarkdownEditor/badge.svg?branch=master
[coveralls_url]: https://coveralls.io/github/hpi-swa-teaching/MarkdownEditor
[github_actions_badge]: https://github.com/hpi-swa-teaching/MarkdownEditor/workflows/CI/badge.svg?branch=master
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
tests
testUnkownLowercaseKeywordIsInstanceVariable

"Temporarily disabled until we understand what this test actually asserts"
"| source parsedRanges |
| source parsedRanges |
source := 'someMethodName: someArgument', Character cr, 'someInstanceVariable'.
parsedRanges := self rangesForSource: source.
self assert: #instVar equals: parsedRanges last type.
self assert: 30 equals: parsedRanges last start.
self assert: 49 equals: parsedRanges last end"
self assert: 49 equals: parsedRanges last end
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
tests
testUnkownUppercaseKeywordIsGlobalVariable

"Temporarily disabled until we understand what this test actually asserts"
"| source parsedRanges |
| source parsedRanges |
source := 'someMethodName: someArgument', Character cr, 'SomeGlobalVariable'.
parsedRanges := self rangesForSource: source.
self assert: #globalVar equals: parsedRanges last type.
self assert: 30 equals: parsedRanges last start.
self assert: 47 equals: parsedRanges last end"
self assert: 47 equals: parsedRanges last end
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"instance" : {
"rangesForSource:" : "fgo 7/3/2019 18:03",
"setUp" : "fgo 7/3/2019 17:57",
"testUnkownLowercaseKeywordIsInstanceVariable" : "mas 5/17/2020 22:04",
"testUnkownUppercaseKeywordIsGlobalVariable" : "mas 5/17/2020 22:04" } }
"testUnkownLowercaseKeywordIsInstanceVariable" : "MAS 5/28/2020 11:08",
"testUnkownUppercaseKeywordIsGlobalVariable" : "MAS 5/28/2020 11:08" } }
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ parse support
initializeInstanceVariables

instanceVariables := #().
allowUnderscoreAssignments := Scanner allowUnderscoreAsAssignment.
allowUnderscoreAssignments := Scanner allowUnderscoreAsAssignment.
allowUnderscoreSelectors := Scanner prefAllowUnderscoreSelectors.
allowBlockArgumentAssignment := Scanner allowBlockArgumentAssignment.
sourcePosition := 1.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ parse
parseBinary

self parseUnary.
[ self currentTokenType == #binary ]
[ self currentTokenType == #binary ]
whileTrue: [
self scanPast: #binary.
self
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
as yet unclassified
parseIdentifier
"currentToken is either a name of an existing variable, a prefix of a variable or an undefined identifier. Return the appropriate range type for it."

currentToken = #self ifTrue: [ ^#self ].
currentToken = #true ifTrue: [ ^#true ].
currentToken = #false ifTrue: [ ^#false ].
currentToken = #nil ifTrue: [ ^#nil ].
currentToken = #super ifTrue: [ ^#super ].
currentToken = #thisContext ifTrue: [ ^#thisContext ].

arguments size to: 1 by: -1 do: [ :level |
(arguments at: level) ifNotNil: [ :levelArguments |
(levelArguments includes: currentToken) ifTrue: [
^level = 1
ifTrue: [ #methodArg ]
ifFalse: [ #blockArg ] ] ].
(temporaries at: level) ifNotNil: [ :levelTemporaries |
(levelTemporaries includes: currentToken) ifTrue: [
^level = 1
ifTrue: [ #tempVar ]
ifFalse: [ #blockTempVar ] ] ] ].

(instanceVariables includes: currentToken) ifTrue: [^#instVar].

workspace
ifNotNil: [(workspace hasBindingOf: currentToken) ifTrue: [^#workspaceVar]].

(Symbol lookup: currentToken) ifNotNil: [:sym |
classOrMetaClass
ifNotNil: [
classOrMetaClass theNonMetaClass withAllSuperclassesDo: [:c |
(c classPool bindingOf: sym) ifNotNil: [^#classVar].
c sharedPools do: [:p | (p bindingOf: sym) ifNotNil: [^#poolConstant]].
(c environment bindingOf: sym) ifNotNil: [^#globalVar]]]
ifNil: [(environment bindingOf: sym) ifNotNil: [^#globalVar]]].

^ currentToken first isUppercase "Very prone to mistakes, but less chatty"
ifTrue: [#globalVar]
ifFalse: [#instVar]
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
parse
parseKeyword
| keyword rangeIndices |

| keyword rangeIndices |
self parseBinary.
self currentTokenType == #keyword ifFalse: [ ^self ].

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
parse
parseUnary
[ self currentTokenType == #name ] whileTrue: [

[ self currentTokenType == #name ] whileTrue: [
self scanPast: #unary]

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"class" : {
"class" : {
},
"instance" : {
"initializeInstanceVariables" : "mas 5/17/2020 21:24",
"parseBinary" : "mas 5/18/2020 17:28",
"parseKeyword" : "mas 5/18/2020 17:28",
"parseUnary" : "mas 5/18/2020 17:28",
"resolve:" : "fgo 7/1/2019 10:53" } }
"instance" : {
"initializeInstanceVariables" : "MAS 5/28/2020 11:10",
"parseBinary" : "MAS 5/28/2020 11:10",
"parseIdentifier" : "MAS 5/28/2020 11:09",
"parseKeyword" : "MAS 5/28/2020 11:10",
"parseUnary" : "MAS 5/28/2020 11:10" } }

0 comments on commit 7ce897f

Please sign in to comment.