PageRenderTime 54ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/etc/simple_regexp_scanner.rb

http://github.com/rubychan/coderay
Ruby | 449 lines | 415 code | 18 blank | 16 comment | 6 complexity | d048c6b2586f805751c53931b003f58b MD5 | raw file
  1. # SimpleRegexpScanner is a scanner for simple regular expressions.
  2. #
  3. # Written by murphy (Kornelius Kalnbach), September 2008.
  4. #
  5. # Released under LGPL, see http://www.gnu.org/licenses/lgpl.html.
  6. require 'strscan'
  7. # A very simple scanner that can parse a subset of regular expressions. It can parse:
  8. # - Literals: A (including empty words)
  9. # - Groups: (A)
  10. # - Concatenations: AB
  11. # - Alternatives: A|B
  12. # - Options: (A)? (for groups only!)
  13. #
  14. # Usage:
  15. # srs = SimpleRegexpScanner.new('(A)?(B|C)')
  16. # p srs.list #=> ['AB', 'AC', 'B', 'C']
  17. class SimpleRegexpScanner < StringScanner
  18. # Returns an Array of all possible strings that would fit the given regexp.
  19. def list
  20. scan_union.uniq
  21. end
  22. protected
  23. def scan_group # :nodoc:
  24. scan(/\(/) or return
  25. options = scan_union
  26. scan(/\)/) or raise ') expected at end of group'
  27. options << '' if scan(/\?/)
  28. options
  29. end
  30. def scan_union # :nodoc:
  31. options = scan_concatenation
  32. options += scan_union if scan(/\|/)
  33. options.uniq
  34. end
  35. def scan_concatenation # :nodoc:
  36. options = scan_group || [scan(/[^(|)?]*/)]
  37. if check(/[^|)]/)
  38. suffixes = scan_concatenation
  39. options.map! do |option|
  40. suffixes.map { |suffix| option + suffix }
  41. end.flatten!
  42. end
  43. options
  44. end
  45. end
  46. if $0 == __FILE__
  47. $VERBOSE = true
  48. eval DATA.read, nil, $0, __LINE__ + 4
  49. end
  50. __END__
  51. require 'test/unit'
  52. class SimpleRegexpScannerTest < Test::Unit::TestCase
  53. def assert_scans_list regexp, list
  54. assert_equal list, SimpleRegexpScanner.new(regexp).list
  55. end
  56. def assert_scans_list_size regexp, size
  57. assert_equal size, SimpleRegexpScanner.new(regexp).list.size
  58. end
  59. def test_simple
  60. assert_scans_list '', ['']
  61. assert_scans_list '()', ['']
  62. assert_scans_list '|', ['']
  63. assert_scans_list 'A', ['A']
  64. assert_scans_list 'A|B', ['A', 'B']
  65. assert_scans_list '(A)', ['A']
  66. assert_scans_list '(A)B', ['AB']
  67. assert_scans_list 'A(B)', ['AB']
  68. end
  69. def test_complex
  70. assert_scans_list 'A|', ['A', '']
  71. assert_scans_list '|A', ['', 'A']
  72. assert_scans_list '(((|(((|))))|)|)', ['']
  73. assert_scans_list '(A|B)', ['A', 'B']
  74. assert_scans_list '(A)?', ['A', '']
  75. assert_scans_list '(A|B)?', ['A', 'B', '']
  76. assert_scans_list 'A(B)?', ['AB', 'A']
  77. assert_scans_list '(A(B(C|D))?)?', ['ABC', 'ABD', 'A', '']
  78. end
  79. def test_deep_recusion
  80. n = 1_000
  81. assert_nothing_raised do
  82. assert_scans_list '(' * n + ')' * n, ['']
  83. end
  84. n = 10_000
  85. assert_raise SystemStackError do
  86. assert_scans_list '(' * n + ')' * n, ['']
  87. end
  88. end
  89. JAVA_BUILTIN_TYPES = <<-TYPES.delete(" \n")
  90. (R(GBImageFilter|MI(S(ocketFactory|e(curity(Manager|Exception)|rver(SocketFactor
  91. y|Impl(_Stub)?)?))|C(onnect(ion(Impl(_Stub)?)?|or(Server)?)|l(ientSocketFactory|
  92. assLoader(Spi)?))|IIOPServerImpl|JRMPServerImpl|FailureHandler)|SA(MultiPrimePri
  93. vateCrtKey(Spec)?|OtherPrimeInfo|P(ublicKey(Spec)?|rivate(CrtKey(Spec)?|Key(Spec
  94. )?))|Key(GenParameterSpec)?)|o(otPane(Container|UI)|und(Rectangle2D|ingMode)|w(M
  95. apper|Set(Reader|MetaData(Impl)?|Internal|Event|W(arning|riter)|Listener)?)|le(R
  96. esult|Status|NotFoundException|Info(NotFoundException)?|Unresolved(List)?|List)?
  97. |bot)|dn|C(2ParameterSpec|5ParameterSpec)|u(n(nable|time(M(XBean|BeanException)|
  98. OperationsException|Permission|E(rrorException|xception))?)|leBasedCollator)|TFE
  99. ditorKit|e(s(caleOp|o(urceBundle|l(utionSyntax|ve(Result|r)))|ult(Set(MetaData)?
  100. )?|ponseCache)|nder(ingHints|Context|e(dImage(Factory)?|r)|ableImage(Op|Producer
  101. )?)|c(tang(ularShape|le(2D)?)|eiver)|tention(Policy)?|jectedExecution(Handler|Ex
  102. ception)|p(licateScaleFilter|aintManager)|entrant(ReadWriteLock|Lock)|verbType|q
  103. u(iredModelMBean|estingUserName)|f(er(ence(UriSchemesSupported|able|Queue)?|ralE
  104. xception)|lect(ionException|Permission)|resh(able|FailedException)|Addr)?|lation
  105. (S(upport(MBean)?|ervice(MBean|NotRegisteredException)?)|Not(ification|FoundExce
  106. ption)|Type(Support|NotFoundException)?|Exception)?|a(d(er|OnlyBufferException|a
  107. ble(ByteChannel)?|WriteLock)|lmC(hoiceCallback|allback))|gi(st(erableService|ry(
  108. Handler)?)|on)|mote(Ref|S(tub|erver)|Call|Object(InvocationHandler)?|Exception)?
  109. )|a(ster(Op|FormatException)?|ndom(Access(File)?)?))|G(uard(edObject)?|ener(ic(S
  110. ignatureFormatError|Declaration|ArrayType)|al(SecurityException|Path))|ZIP(Input
  111. Stream|OutputStream)|lyph(Metrics|JustificationInfo|V(iew|ector))|a(theringByteC
  112. hannel|ugeMonitor(MBean)?|pContent|rbageCollectorMXBean)|r(id(Bag(Constraints|La
  113. yout)|Layout)|oup|egorianCalendar|a(yFilter|dientPaint|phic(s(2D|Config(uration|
  114. Template)|Device|Environment)?|Attribute))))|X(ML(GregorianCalendar|Constants|De
  115. coder|ParseException|Encoder|Formatter)|id|Path(Constants|Ex(ception|pression(Ex
  116. ception)?)|VariableResolver|F(unction(Resolver|Exception)?|actory(ConfigurationE
  117. xception)?))?|50(9(C(RL(Selector|Entry)?|ert(ificate|Selector))|TrustManager|E(n
  118. codedKeySpec|xten(sion|dedKeyManager))|KeyManager)|0Pri(ncipal|vateCredential))|
  119. ml(Reader|Writer)|A(Resource|Connection|DataSource|Exception))|M(GF1ParameterSpe
  120. c|Bean(Registration(Exception)?|Server(Builder|Notification(Filter)?|Connection|
  121. InvocationHandler|Delegate(MBean)?|Permission|F(orwarder|actory))?|NotificationI
  122. nfo|ConstructorInfo|TrustPermission|Info|OperationInfo|P(ermission|arameterInfo)
  123. |Exception|FeatureInfo|AttributeInfo)|i(ssing(ResourceException|Format(WidthExce
  124. ption|ArgumentException))|nimalHTMLWriter|di(Message|System|Channel|Device(Provi
  125. der)?|UnavailableException|Event|File(Reader|Format|Writer))|xer(Provider)?|meTy
  126. peParseException)|o(nitor(MBean|SettingException|Notification)?|d(ifi(cationItem
  127. |er)|elMBean(Notification(Broadcaster|Info)|ConstructorInfo|Info(Support)?|Opera
  128. tionInfo|AttributeInfo)?)|use(Motion(Listener|Adapter)|In(put(Listener|Adapter)|
  129. fo)|DragGestureRecognizer|Event|Wheel(Event|Listener)|Listener|Adapter))|u(table
  130. (ComboBoxModel|TreeNode|AttributeSet)|lti(RootPaneUI|castSocket|Menu(BarUI|ItemU
  131. I)|ButtonUI|S(croll(BarUI|PaneUI)|p(innerUI|litPaneUI)|eparatorUI|liderUI)|Co(lo
  132. rChooserUI|mboBoxUI)|T(ool(BarUI|TipUI)|extUI|ab(le(HeaderUI|UI)|bedPaneUI)|reeU
  133. I)|InternalFrameUI|ple(Master|DocumentHandling)|OptionPaneUI|D(oc(Print(Service|
  134. Job))?|esktop(IconUI|PaneUI))|P(ixelPackedSampleModel|opupMenuUI|anelUI|rogressB
  135. arUI)|ViewportUI|FileChooserUI|L(istUI|ookAndFeel|abelUI)))|e(ssage(Digest(Spi)?
  136. |Format)|nu(Bar(UI)?|S(hortcut|electionManager)|Co(ntainer|mponent)|Item(UI)?|Dr
  137. agMouse(Event|Listener)|E(vent|lement)|Key(Event|Listener)|Listener)?|t(hod(Desc
  138. riptor)?|a(Message|EventListener|l(R(ootPaneUI|adioButtonUI)|MenuBarUI|B(orders|
  139. uttonUI)|S(croll(B(utton|arUI)|PaneUI)|plitPaneUI|eparatorUI|liderUI)|C(heckBox(
  140. Icon|UI)|omboBox(Button|Icon|UI|Editor))|T(heme|o(ol(BarUI|TipUI)|ggleButtonUI)|
  141. extFieldUI|abbedPaneUI|reeUI)|I(nternalFrame(TitlePane|UI)|conFactory)|DesktopIc
  142. onUI|P(opupMenuSeparatorUI|rogressBarUI)|FileChooserUI|L(ookAndFeel|abelUI))))|d
  143. ia(Size(Name)?|Name|Tra(y|cker)|PrintableArea)?|m(ory(M(XBean|anagerMXBean)|Hand
  144. ler|NotificationInfo|CacheImage(InputStream|OutputStream)|Type|ImageSource|Usage
  145. |PoolMXBean)|ber))|a(skFormatter|n(ifest|age(ReferralControl|rFactoryParameters|
  146. ment(Permission|Factory)))|c(Spi)?|t(h(Context)?|ch(Result|er)|teBorder)|p(pedBy
  147. teBuffer)?|lformed(InputException|ObjectNameException|URLException|Parameterized
  148. TypeException|LinkException)|rshal(Exception|ledObject))|Let(MBean)?)|B(yte(Buff
  149. er|Channel|Order|LookupTable|Array(InputStream|OutputStream))?|MPImageWriteParam
  150. |i(n(d(ing|Exception)|aryRefAddr)|tSet|di|g(Integer|Decimal))|o(o(k|lean(Control
  151. )?)|undedRangeModel|rder(UIResource|Factory|Layout)?|x(View|Layout)?)|u(tton(Gro
  152. up|Model|UI)?|ffer(Strategy|Capabilities|ed(Reader|I(nputStream|mage(Op|Filter)?
  153. )|OutputStream|Writer)|OverflowException|UnderflowException)?)|e(velBorder|an(s|
  154. Context(Membership(Event|Listener)|S(upport|ervice(s(Support|Listener)?|Revoked(
  155. Event|Listener)|Provider(BeanInfo)?|AvailableEvent))|C(hild(Support|ComponentPro
  156. xy)?|ontainerProxy)|Proxy|Event)?|Info|Descriptor))|lo(ck(ingQueue|View)|b)|a(s(
  157. ic(R(ootPaneUI|adioButton(MenuItemUI|UI))|GraphicsUtils|Menu(BarUI|ItemUI|UI)|B(
  158. orders|utton(UI|Listener))|S(croll(BarUI|PaneUI)|troke|p(innerUI|litPane(Divider
  159. |UI))|eparatorUI|liderUI)|HTML|C(heckBox(MenuItemUI|UI)|o(ntrol|lorChooserUI|mbo
  160. (Box(Renderer|UI|Editor)|Popup)))|T(o(ol(Bar(SeparatorUI|UI)|TipUI)|ggleButtonUI
  161. )|ext(UI|PaneUI|FieldUI|AreaUI)|ab(le(HeaderUI|UI)|bedPaneUI)|reeUI)|I(nternalFr
  162. ame(TitlePane|UI)|conFactory)|OptionPaneUI|D(irectoryModel|esktop(IconUI|PaneUI)
  163. )|P(opupMenu(SeparatorUI|UI)|ermission|a(sswordFieldUI|nelUI)|rogressBarUI)|Edit
  164. orPaneUI|ViewportUI|F(ileChooserUI|ormattedTextFieldUI)|L(istUI|ookAndFeel|abelU
  165. I)|A(ttribute(s)?|rrowButton))|eRowSet)|nd(CombineOp|edSampleModel)|ckingStoreEx
  166. ception|tchUpdateException|d(BinaryOpValueExpException|StringOperationException|
  167. PaddingException|LocationException|AttributeValueExpException))|r(okenBarrierExc
  168. eption|eakIterator))|S(slRMI(ServerSocketFactory|ClientSocketFactory)|h(ort(Mess
  169. age|Buffer(Exception)?|LookupTable)?|eetCollate|ape(GraphicAttribute)?)|y(s(tem(
  170. Color|FlavorMap)?|exMessage)|n(c(hronousQueue|Resolver|Provider(Exception)?|Fa(c
  171. tory(Exception)?|iledException))|th(GraphicsUtils|Style(Factory)?|Con(stants|tex
  172. t)|esizer|Painter|LookAndFeel)))|c(he(duled(ThreadPoolExecutor|ExecutorService|F
  173. uture)|ma(ViolationException|Factory(Loader)?)?)|a(nner|tteringByteChannel)|roll
  174. (BarUI|Pane(Constants|UI|Layout|Adjustable)?|able|bar))|t(yle(Sheet|d(Document|E
  175. ditorKit)|Con(stants|text))?|ub(NotFoundException|Delegate)?|a(ndardMBean|ck(Tra
  176. ceElement|OverflowError)?|te(Edit(able)?|Factory|ment)|rtTlsRe(sponse|quest))|r(
  177. i(ng(Re(fAddr|ader)|Monitor(MBean)?|Bu(ilder|ffer(InputStream)?)|Selection|C(har
  178. acterIterator|ontent)|Tokenizer|IndexOutOfBoundsException|ValueExp|Writer)?|ctMa
  179. th)|oke|uct|eam(Result|Source|Handler|CorruptedException|Tokenizer|PrintService(
  180. Factory)?)))|i(ngle(SelectionModel|PixelPackedSampleModel)|ze(Requirements|Seque
  181. nce|2DSyntax|LimitExceededException)|des|gn(e(dObject|r)|ature(Spi|Exception)?)|
  182. mple(BeanInfo|T(ype|imeZone)|D(oc|ateFormat)|Formatter|AttributeSet))|SL(S(ocket
  183. (Factory)?|e(ssion(Binding(Event|Listener)|Context)?|rverSocket(Factory)?))|Hand
  184. shakeException|Context(Spi)?|P(e(erUnverifiedException|rmission)|rotocolExceptio
  185. n)|E(ngine(Result)?|xception)|KeyException)|o(cket(SecurityException|Handler|Cha
  186. nnel|TimeoutException|Impl(Factory)?|Options|Permission|Exception|Factory|Addres
  187. s)?|u(ndbank(Re(source|ader))?|rce(DataLine|Locator)?)|ft(Reference|BevelBorder)
  188. |rt(ResponseControl|ingFocusTraversalPolicy|Control|ed(Map|Set)|Key))|u(pp(orted
  189. ValuesAttribute|ressWarnings)|bject(D(omainCombiner|elegationPermission))?)|p(in
  190. ner(Model|NumberModel|DateModel|UI|ListModel)|litPaneUI|ring(Layout)?)|e(c(ur(it
  191. y(Manager|Permission|Exception)?|e(Random(Spi)?|C(lassLoader|acheResponse)))|ret
  192. Key(Spec|Factory(Spi)?)?)|t(OfIntegerSyntax)?|paratorUI|verity|quence(InputStrea
  193. m|r)?|lect(ionKey|or(Provider)?|ableChannel)|a(ledObject|rch(Result|Controls))|r
  194. (ial(Ref|Blob|izable(Permission)?|Struct|Clob|Datalink|JavaObject|Exception|Arra
  195. y)|v(ice(Registry|NotFoundException|U(navailableException|I(Factory)?)|Permissio
  196. n)|er(R(untimeException|ef)|Socket(Channel|Factory)?|NotActiveException|CloneExc
  197. eption|E(rror|xception))))|gment|maphore)|keleton(MismatchException|NotFoundExce
  198. ption)?|wing(Constants|Utilities|PropertyChangeSupport)|liderUI|a(sl(Server(Fact
  199. ory)?|Client(Factory)?|Exception)?|vepoint|mpleModel)|QL(Input(Impl)?|Output(Imp
  200. l)?|Data|Permission|Exception|Warning)|AX(Result|Source|TransformerFactory|Parse
  201. r(Factory)?))|H(yperlink(Event|Listener)|ttp(sURLConnection|RetryException|URLCo
  202. nnection)|i(erarchy(Bounds(Listener|Adapter)|Event|Listener)|ghlighter)|ostnameV
  203. erifier|TML(Document|EditorKit|FrameHyperlinkEvent|Writer)?|eadlessException|a(s
  204. (h(Map|table|Set|DocAttributeSet|Print(RequestAttributeSet|ServiceAttributeSet|J
  205. obAttributeSet)|AttributeSet)|Controls)|nd(shakeCompleted(Event|Listener)|ler)))
  206. |N(o(RouteToHostException|n(ReadableChannelException|invertibleTransformExceptio
  207. n|WritableChannelException)|t(BoundException|ification(Result|Broadcaster(Suppor
  208. t)?|Emitter|Filter(Support)?|Listener)?|SerializableException|Yet(BoundException
  209. |ConnectedException)|Co(ntextException|mpliantMBeanException)|OwnerException|Act
  210. iveException)|Such(MethodE(rror|xception)|ObjectException|P(addingException|rovi
  211. derException)|ElementException|FieldE(rror|xception)|A(ttributeException|lgorith
  212. mException))|deChange(Event|Listener)|C(onnectionPendingException|lassDefFoundEr
  213. ror)|InitialContextException|PermissionException)|u(ll(Cipher|PointerException)|
  214. m(ericShaper|ber(Of(InterveningJobs|Documents)|Up(Supported)?|Format(ter|Excepti
  215. on)?)?))|e(t(Permission|workInterface)|gativeArraySizeException)|a(vigationFilte
  216. r|m(ing(Manager|SecurityException|E(numeration|vent|xception(Event)?)|Listener)?
  217. |e(spaceC(hangeListener|ontext)|NotFoundException|C(lassPair|allback)|Parser|Alr
  218. eadyBoundException)?)))|C(h(oice(Callback|Format)?|eck(sum|ed(InputStream|Output
  219. Stream)|box(Group|MenuItem)?)|a(n(nel(s)?|ge(dCharSetException|Event|Listener))|
  220. r(set(Decoder|Provider|Encoder)?|Buffer|Sequence|ConversionException|acter(Codin
  221. gException|Iterator)?|Array(Reader|Writer)))|romaticity)|R(C32|L(Selector|Except
  222. ion)?)|yclicBarrier|MMException|ipher(Spi|InputStream|OutputStream)?|SS|o(n(s(tr
  223. uctor|oleHandler)|nect(ion(P(oolDataSource|endingException)|Event(Listener)?)?|I
  224. OException|Exception)|current(M(odificationException|ap)|HashMap|LinkedQueue)|t(
  225. e(nt(Model|Handler(Factory)?)|xt(NotEmptyException|ualRenderedImageFactory)?)|ai
  226. ner(OrderFocusTraversalPolicy|Event|Listener|Adapter)?|rol(lerEventListener|Fact
  227. ory)?)|dition|volveOp|fi(rmationCallback|guration(Exception)?))|okieHandler|d(in
  228. gErrorAction|e(S(igner|ource)|r(Result|MalfunctionError)))|unt(erMonitor(MBean)?
  229. |DownLatch)|p(yOnWriteArray(Set|List)|ies(Supported)?)|l(or(Model|S(upported|pac
  230. e|electionModel)|C(hooser(ComponentFactory|UI)|onvertOp)|Type|UIResource)?|l(ect
  231. ion(s|CertStoreParameters)?|at(ion(ElementIterator|Key)|or)))|m(p(il(er|ationMXB
  232. ean)|o(site(Name|Context|Type|Data(Support)?|View)?|nent(SampleModel|ColorModel|
  233. InputMap(UIResource)?|Orientation|UI|Event|View|Listener|Adapter)?|und(Border|Na
  234. me|Control|Edit))|letionService|ara(tor|ble)|ression)|municationException|bo(Box
  235. (Model|UI|Editor)|Popup)))|u(stomizer|r(sor|rency)|bicCurve2D)|e(ll(RendererPane
  236. |Editor(Listener)?)|rt(ificate(NotYetValidException|ParsingException|E(ncodingEx
  237. ception|x(ception|piredException))|Factory(Spi)?)?|S(tore(Spi|Parameters|Excepti
  238. on)?|elector)|Path(Builder(Result|Spi|Exception)?|TrustManagerParameters|Paramet
  239. ers|Validator(Result|Spi|Exception)?)?))|l(ip(board(Owner)?)?|o(se(d(ByInterrupt
  240. Exception|SelectorException|ChannelException)|able)|ne(NotSupportedException|abl
  241. e)|b)|ass(NotFoundException|C(ircularityError|astException)|De(sc|finition)|F(il
  242. eTransformer|ormatError)|Load(ingMXBean|er(Repository)?))?)|a(n(not(RedoExceptio
  243. n|UndoException|ProceedException)|cel(l(edKeyException|ationException)|ablePrint
  244. Job)|vas)|che(Re(sponse|quest)|dRowSet)|l(endar|l(able(Statement)?|back(Handler)
  245. ?))|r(dLayout|et(Event|Listener)?))|r(opImageFilter|edential(NotFoundException|E
  246. x(ception|piredException))))|T(hr(owable|ead(Group|MXBean|Info|Death|PoolExecuto
  247. r|Factory|Local)?)|ype(s|NotPresentException|InfoProvider|Variable)?|i(tledBorde
  248. r|e|leObserver|me(stamp|outException|Zone|Unit|r(MBean|Notification|Task|AlarmCl
  249. ockNotification)?|LimitExceededException)?)|oo(ManyListenersException|l(BarUI|Ti
  250. p(Manager|UI)|kit))|e(xt(Measurer|Syntax|HitInfo|Component|urePaint|InputCallbac
  251. k|OutputCallback|UI|Event|Field|L(istener|ayout)|A(ction|ttribute|rea))|mplates(
  252. Handler)?)|a(rget(edNotification|DataLine)?|gElement|b(S(top|et)|ular(Type|Data(
  253. Support)?)|Expander|le(Model(Event|Listener)?|HeaderUI|C(olumn(Model(Event|Liste
  254. ner)?)?|ell(Renderer|Editor))|UI|View)|ableView|bedPaneUI))|r(ust(Manager(Factor
  255. y(Spi)?)?|Anchor)|ee(M(odel(Event|Listener)?|ap)|Se(t|lection(Model|Event|Listen
  256. er))|Node|Cell(Renderer|Editor)|UI|Path|Expansion(Event|Listener)|WillExpandList
  257. ener)|a(ns(parency|f(orm(er(Handler|ConfigurationException|Exception|Factory(Con
  258. figurationError)?)?|Attribute)|er(Handler|able))|action(R(olledbackException|equ
  259. iredException)|alWriter)|mitter)|ck)))|I(n(s(t(an(ce(NotFoundException|AlreadyEx
  260. istsException)|tiationE(rror|xception))|rument(ation)?)|ufficientResourcesExcept
  261. ion|ets(UIResource)?)|herit(ed|ableThreadLocal)|comp(leteAnnotationException|ati
  262. bleClassChangeError)|t(Buffer|e(r(na(tionalFormatter|l(Error|Frame(UI|Event|Focu
  263. sTraversalPolicy|Listener|Adapter)))|rupt(ibleChannel|ed(NamingException|IOExcep
  264. tion|Exception)))|ger(Syntax)?)|rospect(ionException|or))|itial(Context(Factory(
  265. Builder)?)?|DirContext|LdapContext)|dex(ColorModel|edProperty(ChangeEvent|Descri
  266. ptor)|OutOfBoundsException)|put(M(ismatchException|ethod(Requests|Highlight|Cont
  267. ext|Descriptor|Event|Listener)?|ap(UIResource)?)|S(tream(Reader)?|ubset)|Context
  268. |Event|Verifier)|et(SocketAddress|4Address|Address|6Address)|v(ocation(Handler|T
  269. argetException|Event)|alid(R(ole(InfoException|ValueException)|elation(ServiceEx
  270. ception|TypeException|IdException))|M(idiDataException|arkException)|Search(Cont
  271. rolsException|FilterException)|NameException|ClassException|T(argetObjectTypeExc
  272. eption|ransactionException)|O(penTypeException|bjectException)|DnDOperationExcep
  273. tion|P(arameter(SpecException|Exception)|r(opertiesFormatException|eferencesForm
  274. atException))|Key(SpecException|Exception)|A(ctivityException|ttribute(sExceptio
  275. n|IdentifierException|ValueException)|pplicationException|lgorithmParameterExcep
  276. tion)))|flater(InputStream)?|lineView)|con(UIResource|View)?|te(ra(tor|ble)|m(Se
  277. lectable|Event|Listener))|dentity(Scope|HashMap)?|CC_(ColorSpace|Profile(RGB|Gra
  278. y)?)|IO(Re(ad(UpdateListener|ProgressListener|WarningListener)|gistry)|Metadata(
  279. Node|Controller|Format(Impl)?)?|ByteBuffer|ServiceProvider|I(nvalidTreeException
  280. |mage)|Param(Controller)?|Exception|Write(ProgressListener|WarningListener))|OEx
  281. ception|vParameterSpec|llegal(MonitorStateException|Block(ingModeException|SizeE
  282. xception)|S(tateException|electorException)|C(harsetNameException|omponentStateE
  283. xception|lassFormatException)|ThreadStateException|PathStateException|Format(Co(
  284. nversionException|dePointException)|PrecisionException|Exception|FlagsException|
  285. WidthException)|A(ccessE(rror|xception)|rgumentException))|mag(ingOpException|e(
  286. Read(er(Spi|WriterSpi)?|Param)|GraphicAttribute|C(onsumer|apabilities)|T(ypeSpec
  287. ifier|ranscoder(Spi)?)|I(nputStream(Spi|Impl)?|con|O)|O(utputStream(Spi|Impl)?|b
  288. server)|Producer|View|Filter|Write(Param|r(Spi)?))?))|Z(ip(InputStream|OutputStr
  289. eam|E(ntry|xception)|File)|oneView)|O(ceanTheme|ut(put(Stream(Writer)?|DeviceAss
  290. igned|Keys)|OfMemoryError)|p(tion(PaneUI|alDataException)?|e(n(MBean(Constructor
  291. Info(Support)?|Info(Support)?|OperationInfo(Support)?|ParameterInfo(Support)?|At
  292. tributeInfo(Support)?)|Type|DataException)|rati(ngSystemMXBean|on(sException|Not
  293. SupportedException)?)))|ver(la(yLayout|ppingFileLockException)|ride)|wner|rienta
  294. tionRequested|b(serv(er|able)|j(ID|ect(Stream(C(onstants|lass)|Exception|Field)|
  295. Name|ChangeListener|In(stance|put(Stream|Validation)?)|Output(Stream)?|View|Fact
  296. ory(Builder)?)?))|AEPParameterSpec)|D(GC|ynamicMBean|nDConstants|i(splayMode|cti
  297. onary|alog|r(StateFactory|Context|ect(oryManager|ColorModel)|ObjectFactory)|gest
  298. (InputStream|OutputStream|Exception)|mension(2D|UIResource)?)|SA(P(ublicKey(Spec
  299. )?|aram(s|eterSpec)|rivateKey(Spec)?)|Key(PairGenerator)?)|H(GenParameterSpec|P(
  300. ublicKey(Spec)?|arameterSpec|rivateKey(Spec)?)|Key)|o(c(ument(Builder(Factory)?|
  301. Name|ed|Parser|Event|Filter|Listener)?|PrintJob|Flavor|Attribute(Set)?)?|uble(Bu
  302. ffer)?|mainCombiner)|u(plicateFormatFlagsException|ration)|TD(Constants)?|e(s(cr
  303. iptor(Support|Access)?|t(ination|roy(able|FailedException))|ignMode|ktop(Manager
  304. |IconUI|PaneUI))|cimalFormat(Symbols)?|precated|f(later(OutputStream)?|ault(M(ut
  305. ableTreeNode|e(nuLayout|talTheme))|B(oundedRangeModel|uttonModel)|S(tyledDocumen
  306. t|ingleSelectionModel)|Highlighter|C(o(lorSelectionModel|mboBoxModel)|ellEditor|
  307. aret)|T(extUI|able(Model|C(olumnModel|ellRenderer))|ree(Model|SelectionModel|Cel
  308. l(Renderer|Editor)))|DesktopManager|PersistenceDelegate|EditorKit|KeyboardFocusM
  309. anager|Fo(cus(Manager|TraversalPolicy)|rmatter(Factory)?)|L(ist(Model|SelectionM
  310. odel|CellRenderer)|oaderRepository)))|l(egationPermission|ay(ed|Queue))|bugGraph
  311. ics)|OM(Result|Source|Locator)|ES(edeKeySpec|KeySpec)|at(e(Time(Syntax|At(C(ompl
  312. eted|reation)|Processing))|Format(ter|Symbols)?)?|a(Buffer(Byte|Short|Int|Double
  313. |UShort|Float)?|type(Con(stants|figurationException)|Factory)|Source|Truncation|
  314. Input(Stream)?|Output(Stream)?|gram(Socket(Impl(Factory)?)?|Channel|Packet)|F(or
  315. matException|lavor)|baseMetaData|Line))|r(iver(Manager|PropertyInfo)?|opTarget(C
  316. ontext|Dr(opEvent|agEvent)|Event|Listener|Adapter)?|ag(Gesture(Recognizer|Event|
  317. Listener)|Source(MotionListener|Context|Dr(opEvent|agEvent)|Event|Listener|Adapt
  318. er)?)))|U(R(I(Resolver|Syntax(Exception)?|Exception)?|L(StreamHandler(Factory)?|
  319. C(onnection|lassLoader)|Decoder|Encoder)?)|n(s(olicitedNotification(Event|Listen
  320. er)?|upported(C(harsetException|lassVersionError|allbackException)|OperationExce
  321. ption|EncodingException|FlavorException|LookAndFeelException|A(ddressTypeExcepti
  322. on|udioFileException))|atisfiedLinkError)|icastRemoteObject|d(o(Manager|ableEdit
  323. (Support|Event|Listener)?)|eclaredThrowableException)|expectedException|known(Gr
  324. oupException|ServiceException|HostException|ObjectException|Error|Format(Convers
  325. ionException|FlagsException))|re(solved(Permission|AddressException)|coverable(E
  326. ntryException|KeyException)|ferenced)|m(odifiable(SetException|ClassException)|a
  327. (ppableCharacterException|rshalException)))|til(ities|Delegate)?|TFDataFormatExc
  328. eption|I(Resource|Manager|D(efaults)?)|UID)|J(R(ootPane|adioButton(MenuItem)?)|M
  329. (RuntimeException|X(Serv(iceURL|erErrorException)|Connect(ionNotification|or(Ser
  330. ver(MBean|Provider|Factory)?|Provider|Factory)?)|Pr(incipal|oviderException)|Aut
  331. henticator)|enu(Bar|Item)?|Exception)|Button|S(croll(Bar|Pane)|p(inner|litPane)|
  332. eparator|lider)|o(in(RowSet|able)|b(Me(ssageFromOperator|diaSheets(Supported|Com
  333. pleted)?)|S(heets|tate(Reason(s)?)?)|HoldUntil|Name|Impressions(Supported|Comple
  334. ted)?|OriginatingUserName|Priority(Supported)?|KOctets(Supported|Processed)?|Att
  335. ributes))|dbcRowSet|C(heckBox(MenuItem)?|o(lorChooser|m(ponent|boBox)))|T(o(ol(B
  336. ar|Tip)|ggleButton)|ext(Component|Pane|Field|Area)|ab(le(Header)?|bedPane)|ree)|
  337. InternalFrame|OptionPane|D(ialog|esktopPane)|P(opupMenu|EG(HuffmanTable|Image(Re
  338. adParam|WriteParam)|QTable)|a(sswordField|nel)|rogressBar)|EditorPane|ar(InputSt
  339. ream|OutputStream|URLConnection|E(ntry|xception)|File)|Viewport|F(ileChooser|orm
  340. attedTextField|rame)|Window|L(ist|a(yeredPane|bel))|Applet)|P(hantomReference|BE
  341. (ParameterSpec|Key(Spec)?)|i(pe(d(Reader|InputStream|OutputStream|Writer))?|xel(
  342. Grabber|InterleavedSampleModel))|S(SParameterSpec|ource)|o(sition|int(2D|erInfo)
  343. ?|oledConnection|pup(Menu(UI|Event|Listener)?|Factory)?|l(ygon|icy(Node|Qualifie
  344. rInfo)?)|rt(UnreachableException|ableRemoteObject(Delegate)?)?)|u(shback(Reader|
  345. InputStream)|blicKey)|er(sisten(ceDelegate|tMBean)|mission(s|Collection)?)|DLOve
  346. rrideSupported|lain(Document|View)|a(ssword(Callback|View|Authentication)|nel(UI
  347. )?|ck(200|edColorModel|age)|t(hIterator|ch|tern(SyntaxException)?)|int(Context|E
  348. vent)?|per|r(se(Position|Exception|r(ConfigurationException|Delegator)?)|tialRes
  349. ultException|a(graphView|meter(MetaData|Block|izedType|Descriptor)))|ge(sPerMinu
  350. te(Color)?|Ranges|dResults(ResponseControl|Control)|able|Format|Attributes))|K(C
  351. S8EncodedKeySpec|IX(BuilderParameters|CertPath(BuilderResult|Checker|ValidatorRe
  352. sult)|Parameters))|r(i(n(cipal|t(RequestAttribute(Set)?|Graphics|S(tream|ervice(
  353. Lookup|Attribute(Set|Event|Listener)?)?)|er(Resolution|Graphics|M(oreInfo(Manufa
  354. cturer)?|essageFromOperator|akeAndModel)|State(Reason(s)?)?|Name|I(sAcceptingJob
  355. s|nfo|OException)|URI|Job|Exception|Location|AbortException)|Job(Event|Listener|
  356. A(ttribute(Set|Event|Listener)?|dapter))?|E(vent|xception)|able|Quality|Writer))
  357. |ority(BlockingQueue|Queue)|v(ileged(ExceptionAction|Action(Exception)?)|ate(MLe
  358. t|C(lassLoader|redentialPermission)|Key)))|o(cess(Builder)?|t(ocolException|ecti
  359. onDomain)|pert(y(ResourceBundle|Change(Support|Event|Listener(Proxy)?)|Descripto
  360. r|Permission|Editor(Manager|Support)?|VetoException)|ies)|vider(Exception)?|file
  361. DataException|gress(Monitor(InputStream)?|BarUI)|xy(Selector)?)|e(sentationDirec
  362. tion|dicate|paredStatement|ference(s(Factory)?|Change(Event|Listener)))))|E(n(c(
  363. ode(dKeySpec|r)|ryptedPrivateKeyInfo)|tity|um(Map|S(yntax|et)|Con(stantNotPresen
  364. tException|trol)|eration)?)|tchedBorder|ditorKit|C(GenParameterSpec|P(oint|ublic
  365. Key(Spec)?|arameterSpec|rivateKey(Spec)?)|Key|Field(F(2m|p))?)|OFException|vent(
  366. SetDescriptor|Handler|Context|Object|DirContext|Queue|Listener(Proxy|List)?)?|l(
  367. ement(Type|Iterator)?|lip(se2D|ticCurve))|rror(Manager|Listener)?|x(c(hanger|ept
  368. ion(InInitializerError|Listener)?)|te(ndedRe(sponse|quest)|rnalizable)|p(ortExce
  369. ption|andVetoException|ression)|e(cut(ionException|or(s|Service|CompletionServic
  370. e)?)|mptionMechanism(Spi|Exception)?))|mpty(Border|StackException))|V(MID|i(sibi
  371. lity|ew(port(UI|Layout)|Factory)?|rtualMachineError)|o(i(ceStatus|d)|latileImage
  372. )|e(ctor|toableChange(Support|Listener(Proxy)?)|rifyError)|a(l(idator(Handler)?|
  373. ue(Handler(MultiFormat)?|Exp))|riableHeightLayoutCache))|Ke(y(Rep|Generator(Spi)
  374. ?|Manage(r(Factory(Spi)?)?|mentException)|S(t(ore(BuilderParameters|Spi|Exceptio
  375. n)?|roke)|pec)|Pair(Generator(Spi)?)?|E(vent(Dispatcher|PostProcessor)?|xception
  376. )|Factory(Spi)?|map|boardFocusManager|Listener|A(dapter|lreadyExistsException|gr
  377. eement(Spi)?))?|r(nel|beros(Ticket|Principal|Key)))|Q(Name|u(e(ue(dJobCount)?|ry
  378. (E(val|xp))?)|adCurve2D))|F(i(nishings|delity|eld(Position|View)?|l(ter(Reader|I
  379. nputStream|ed(RowSet|ImageSource)|OutputStream|Writer)?|e(Reader|nameFilter|Syst
  380. emView|Handler|N(otFoundException|ameMap)|C(h(ooserUI|annel)|acheImage(InputStre
  381. am|OutputStream))|I(nputStream|mage(InputStream|OutputStream))|OutputStream|D(ia
  382. log|escriptor)|Permission|View|Filter|Writer|Lock(InterruptionException)?)?)|xed
  383. HeightLayoutCache)|o(nt(RenderContext|Metrics|UIResource|FormatException)?|cus(M
  384. anager|TraversalPolicy|Event|Listener|Adapter)|rm(SubmitEvent|at(t(er(ClosedExce
  385. ption)?|able(Flags)?)|ConversionProvider|FlagsConversionMismatchException)?|View
  386. ))|uture(Task)?|eatureDescriptor|l(o(w(View|Layout)|at(Buffer|Control)?)|ushable
  387. |a(tteningPathIterator|vor(Map|Table|E(vent|xception)|Listener)))|a(ctoryConfigu
  388. rationError|iledLoginException)|rame)|W(i(ndow(StateListener|Constants|Event|Foc
  389. usListener|Listener|Adapter)?|ldcardType)|e(ak(Reference|HashMap)|bRowSet)|r(it(
  390. e(r|AbortedException)|able(R(enderedImage|aster)|ByteChannel))|appedPlainView))|
  391. L(i(st(ResourceBundle|Model|Selection(Model|Event|Listener)|CellRenderer|Iterato
  392. r|enerNotFoundException|Data(Event|Listener)|UI|View)?|n(e(Metrics|B(order|reakM
  393. easurer)|2D|Number(Reader|InputStream)|UnavailableException|Event|Listener)?|k(R
  394. ef|ed(BlockingQueue|Hash(Map|Set)|List)|Exception|ageError|LoopException))|mitEx
  395. ceededException)|o(ng(Buffer)?|c(k(Support)?|a(teRegistry|le))|ok(up(Table|Op)|A
  396. ndFeel)|aderHandler|g(Record|Manager|in(Module|Context|Exception)|Stream|g(ing(M
  397. XBean|Permission)|er)))|dap(ReferralException|Name|Context)|e(vel|ase)|DAPCertSt
  398. oreParameters|a(stOwnerException|y(out(Manager(2)?|Queue|FocusTraversalPolicy)|e
  399. redHighlighter)|nguageCallback|bel(UI|View)?))|A(s(sertionError|ync(hronousClose
  400. Exception|BoxView))|n(notat(ion(TypeMismatchException|FormatError)?|edElement)|c
  401. estor(Event|Listener))|c(c(ount(NotFoundException|Ex(ception|piredException)|Loc
  402. kedException)|ess(ible(R(ole|e(sourceBundle|lation(Set)?))|Bundle|S(t(ate(Set)?|
  403. reamable)|election)|Hyper(text|link)|Co(ntext|mponent)|T(ext(Sequence)?|able(Mod
  404. elChange)?)|Icon|Object|E(ditableText|xtended(Component|T(ext|able)))|Value|KeyB
  405. inding|A(ction|ttributeSequence))?|Control(Context|Exception|ler)|Exception))|ti
  406. (on(Map(UIResource)?|Event|Listener)?|v(ity(RequiredException|CompletedException
  407. )|eEvent|at(ion(Group(_Stub|ID|Desc)?|Monitor|System|I(nstantiator|D)|Desc|Excep
  408. tion)|or|eFailedException|able)))|l(NotFoundException|Entry)?)|t(tribute(s|Modif
  409. icationException|Set(Utilities)?|d(String|CharacterIterator)|NotFoundException|C
  410. hangeNotification(Filter)?|InUseException|Exception|ValueExp|List)?|omic(Referen
  411. ce(FieldUpdater|Array)?|MarkableReference|Boolean|StampedReference|Integer(Field
  412. Updater|Array)?|Long(FieldUpdater|Array)?))|d(just(able|ment(Event|Listener))|le
  413. r32)|u(t(h(orizeCallback|enticat(ion(NotSupportedException|Exception)|or)|P(ermi
  414. ssion|rovider))|oscroll)|dio(System|Clip|InputStream|Permission|F(ile(Reader|For
  415. mat|Writer)|ormat)))|pp(ConfigurationEntry|endable|let(Stub|Context|Initializer)
  416. ?)|ffineTransform(Op)?|l(phaComposite|lPermission|ready(BoundException|Connected
  417. Exception)|gorithmParameter(s(Spi)?|Generator(Spi)?|Spec))|r(c2D|ithmeticExcepti
  418. on|ea(AveragingScaleFilter)?|ray(s|BlockingQueue|StoreException|Type|IndexOutOfB
  419. oundsException|List)?)|bstract(M(ethodError|ap)|B(order|utton)|S(pinnerModel|e(t
  420. |quentialList|lect(ionKey|or|ableChannel)))|C(ol(orChooserPanel|lection)|ellEdit
  421. or)|TableModel|InterruptibleChannel|Document|UndoableEdit|Preferences|ExecutorSe
  422. rvice|Queue(dSynchronizer)?|Writer|L(ist(Model)?|ayoutCache)|Action)|WT(Permissi
  423. on|E(vent(Multicaster|Listener(Proxy)?)?|rror|xception)|KeyStroke)))
  424. TYPES
  425. def test_very_long
  426. assert_scans_list_size JAVA_BUILTIN_TYPES, 2389
  427. assert_scans_list_size JAVA_BUILTIN_TYPES + '?', 2389 + 1
  428. assert_scans_list_size JAVA_BUILTIN_TYPES + '(A|B)', 2389 * 2
  429. assert_scans_list_size JAVA_BUILTIN_TYPES + '?(A|B)', (2389 + 1) * 2
  430. end
  431. end