📄 t-gen-conflictstrategies.st
字号:
Object subclass: #ConflictStrategy
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'T-gen-Conflict Strategies'!
ConflictStrategy comment:
'ConflictStrategy implements the action that a translator generator performs when it detects a conflict.
Subclasses must implement the following messages:
resolving
resolveReduceReduceFor:
resolveShiftReduceFor:
'!
!ConflictStrategy methodsFor: 'resolving'!
resolveReduceReduceFor: aTerm atState: currState
self subclassResponsibility!
resolveShiftReduceFor: aTransitSymbol atState: currState
self subclassResponsibility! !
ConflictStrategy subclass: #ShiftingConflictStrategy
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'T-gen-Conflict Strategies'!
ShiftingConflictStrategy comment:
'ShiftingConflictStrategy resolves shift/reduce conflicts by always shifting, this handles most ambiguities correctly.'!
!ShiftingConflictStrategy methodsFor: 'resolving'!
resolveReduceReduceFor: aTerm atState: currState
^OrderedCollection with: currState!
resolveShiftReduceFor: aTransitSymbol atState: currState
currState reduceMap removeKey: aTransitSymbol.
^OrderedCollection new.! !
ConflictStrategy subclass: #StandardConflictStrategy
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'T-gen-Conflict Strategies'!
StandardConflictStrategy comment:
'StandardConflictStrategy implements the standard conflict resolution present in the original T-Gen (i.e., none)'!
!StandardConflictStrategy methodsFor: 'resolving'!
resolveReduceReduceFor: aTerm atState: currState
^OrderedCollection with: currState!
resolveShiftReduceFor: aTransitSymbol atState: currState
^OrderedCollection with: currState! !
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -