1 /* 2 * Copyright (c) 2012-2018 The ANTLR Project. All rights reserved. 3 * Use of this file is governed by the BSD 3-clause license that 4 * can be found in the LICENSE.txt file in the project root. 5 */ 6 7 module antlr.v4.runtime.atn.LexerMoreAction; 8 9 import antlr.v4.runtime.InterfaceLexer; 10 import antlr.v4.runtime.atn.LexerAction; 11 import antlr.v4.runtime.atn.LexerActionType; 12 import antlr.v4.runtime.misc; 13 14 // Singleton LexerMoreAction 15 /** 16 * Provides a singleton instance of this parameterless lexer action. 17 */ 18 class LexerMoreAction : LexerAction 19 { 20 21 /** 22 * The single instance of LexerMoreAction. 23 */ 24 private static __gshared LexerMoreAction instance_; 25 26 /** 27 * @uml 28 * {@inheritDoc} 29 * @return This method returns {@link LexerActionType#MORE}. 30 * @safe 31 * @nothrow 32 */ 33 public LexerActionType getActionType() @safe nothrow 34 { 35 return LexerActionType.MORE; 36 } 37 38 public bool isPositionDependent() 39 { 40 return false; 41 } 42 43 public void execute(InterfaceLexer lexer) 44 { 45 lexer.more(); 46 } 47 48 /** 49 * @uml 50 * @safe 51 * @nothrow 52 * @override 53 */ 54 public override size_t toHash() @safe nothrow 55 { 56 size_t hash = MurmurHash.initialize(); 57 hash = MurmurHash.update(hash, Utils.rank(getActionType)); 58 return MurmurHash.finish(hash, 1); 59 } 60 61 /** 62 * @uml 63 * - @SuppressWarnings("EqualsWhichDoesntCheckParameterClass") 64 */ 65 public bool equals(Object obj) 66 { 67 return obj == this; 68 } 69 70 /** 71 * @uml 72 * @override 73 */ 74 public override string toString() 75 { 76 return "more"; 77 } 78 79 /** 80 * Creates the single instance of LexerMoreAction. 81 */ 82 private shared static this() 83 { 84 instance_ = new LexerMoreAction; 85 } 86 87 /** 88 * Returns: A single instance of LexerMoreAction. 89 */ 90 public static LexerMoreAction instance() 91 { 92 return instance_; 93 } 94 95 }