target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void isFirstLoadInProgress_false() throws Exception { NowPlayingViewModel nowPlayingViewModel = new NowPlayingViewModel(mockApplication, mockServiceGateway); testScheduler.triggerActions(); testScheduler.advanceTimeBy(10, TimeUnit.SECONDS); assertThat(nowPlayingViewModel.getFirstLoad().get()).isFalse(); } | @NonNull public ObservableBoolean getFirstLoad() { return firstLoad; } | NowPlayingViewModel extends ViewModel { @NonNull public ObservableBoolean getFirstLoad() { return firstLoad; } } | NowPlayingViewModel extends ViewModel { @NonNull public ObservableBoolean getFirstLoad() { return firstLoad; } @Inject NowPlayingViewModel(@NonNull Application application, @NonNull ServiceGateway serviceGateway); } | NowPlayingViewModel extends ViewModel { @NonNull public ObservableBoolean getFirstLoad() { return firstLoad; } @Inject NowPlayingViewModel(@NonNull Application application, @NonNull ServiceGateway serviceGateway); @Override void onCleared(); @NonNull List<MovieViewInfo> getMovieViewInfoList(); void loadMoreNowPlayingI... | NowPlayingViewModel extends ViewModel { @NonNull public ObservableBoolean getFirstLoad() { return firstLoad; } @Inject NowPlayingViewModel(@NonNull Application application, @NonNull ServiceGateway serviceGateway); @Override void onCleared(); @NonNull List<MovieViewInfo> getMovieViewInfoList(); void loadMoreNowPlayingI... |
@Test public void getMovieViewInfoList() throws Exception { NowPlayingViewModel nowPlayingViewModel = new NowPlayingViewModel(mockApplication, mockServiceGateway); List<MovieViewInfo> movieViewInfos = nowPlayingViewModel.getMovieViewInfoList(); assertThat(movieViewInfos.size()).isEqualTo(0); } | @NonNull public List<MovieViewInfo> getMovieViewInfoList() { return movieViewInfoList; } | NowPlayingViewModel extends ViewModel { @NonNull public List<MovieViewInfo> getMovieViewInfoList() { return movieViewInfoList; } } | NowPlayingViewModel extends ViewModel { @NonNull public List<MovieViewInfo> getMovieViewInfoList() { return movieViewInfoList; } @Inject NowPlayingViewModel(@NonNull Application application, @NonNull ServiceGateway serviceGateway); } | NowPlayingViewModel extends ViewModel { @NonNull public List<MovieViewInfo> getMovieViewInfoList() { return movieViewInfoList; } @Inject NowPlayingViewModel(@NonNull Application application, @NonNull ServiceGateway serviceGateway); @Override void onCleared(); @NonNull List<MovieViewInfo> getMovieViewInfoList(); void l... | NowPlayingViewModel extends ViewModel { @NonNull public List<MovieViewInfo> getMovieViewInfoList() { return movieViewInfoList; } @Inject NowPlayingViewModel(@NonNull Application application, @NonNull ServiceGateway serviceGateway); @Override void onCleared(); @NonNull List<MovieViewInfo> getMovieViewInfoList(); void l... |
@Test public void isAtScrollEnd() throws Exception { LinearLayoutManager mockLinearLayoutManager = Mockito.mock(LinearLayoutManager.class); RecyclerView mockRecyclerView = Mockito.mock(RecyclerView.class); RecyclerViewScrollEvent mockRecyclerViewScrollEvent = Mockito.mock(RecyclerViewScrollEvent.class); when(mockLinear... | public boolean isAtScrollEnd() { RecyclerView.LayoutManager layoutManager = recyclerViewScrollEvent.view().getLayoutManager(); if (layoutManager instanceof LinearLayoutManager) { LinearLayoutManager linearLayoutManager = (LinearLayoutManager) layoutManager; int totalItemCount = linearLayoutManager.getItemCount(); int l... | ScrollEventCalculator { public boolean isAtScrollEnd() { RecyclerView.LayoutManager layoutManager = recyclerViewScrollEvent.view().getLayoutManager(); if (layoutManager instanceof LinearLayoutManager) { LinearLayoutManager linearLayoutManager = (LinearLayoutManager) layoutManager; int totalItemCount = linearLayoutManag... | ScrollEventCalculator { public boolean isAtScrollEnd() { RecyclerView.LayoutManager layoutManager = recyclerViewScrollEvent.view().getLayoutManager(); if (layoutManager instanceof LinearLayoutManager) { LinearLayoutManager linearLayoutManager = (LinearLayoutManager) layoutManager; int totalItemCount = linearLayoutManag... | ScrollEventCalculator { public boolean isAtScrollEnd() { RecyclerView.LayoutManager layoutManager = recyclerViewScrollEvent.view().getLayoutManager(); if (layoutManager instanceof LinearLayoutManager) { LinearLayoutManager linearLayoutManager = (LinearLayoutManager) layoutManager; int totalItemCount = linearLayoutManag... | ScrollEventCalculator { public boolean isAtScrollEnd() { RecyclerView.LayoutManager layoutManager = recyclerViewScrollEvent.view().getLayoutManager(); if (layoutManager instanceof LinearLayoutManager) { LinearLayoutManager linearLayoutManager = (LinearLayoutManager) layoutManager; int totalItemCount = linearLayoutManag... |
@Test public void isAtScrollEnd_false() throws Exception { LinearLayoutManager mockLinearLayoutManager = Mockito.mock(LinearLayoutManager.class); RecyclerView mockRecyclerView = Mockito.mock(RecyclerView.class); RecyclerViewScrollEvent mockRecyclerViewScrollEvent = Mockito.mock(RecyclerViewScrollEvent.class); when(mock... | public boolean isAtScrollEnd() { RecyclerView.LayoutManager layoutManager = recyclerViewScrollEvent.view().getLayoutManager(); if (layoutManager instanceof LinearLayoutManager) { LinearLayoutManager linearLayoutManager = (LinearLayoutManager) layoutManager; int totalItemCount = linearLayoutManager.getItemCount(); int l... | ScrollEventCalculator { public boolean isAtScrollEnd() { RecyclerView.LayoutManager layoutManager = recyclerViewScrollEvent.view().getLayoutManager(); if (layoutManager instanceof LinearLayoutManager) { LinearLayoutManager linearLayoutManager = (LinearLayoutManager) layoutManager; int totalItemCount = linearLayoutManag... | ScrollEventCalculator { public boolean isAtScrollEnd() { RecyclerView.LayoutManager layoutManager = recyclerViewScrollEvent.view().getLayoutManager(); if (layoutManager instanceof LinearLayoutManager) { LinearLayoutManager linearLayoutManager = (LinearLayoutManager) layoutManager; int totalItemCount = linearLayoutManag... | ScrollEventCalculator { public boolean isAtScrollEnd() { RecyclerView.LayoutManager layoutManager = recyclerViewScrollEvent.view().getLayoutManager(); if (layoutManager instanceof LinearLayoutManager) { LinearLayoutManager linearLayoutManager = (LinearLayoutManager) layoutManager; int totalItemCount = linearLayoutManag... | ScrollEventCalculator { public boolean isAtScrollEnd() { RecyclerView.LayoutManager layoutManager = recyclerViewScrollEvent.view().getLayoutManager(); if (layoutManager instanceof LinearLayoutManager) { LinearLayoutManager linearLayoutManager = (LinearLayoutManager) layoutManager; int totalItemCount = linearLayoutManag... |
@Test public void isSingleton() throws Exception { assertEquals(mRxBus, RxBus.getDefault()); } | public static RxBus getDefault() { return sInstance; } | RxBus { public static RxBus getDefault() { return sInstance; } } | RxBus { public static RxBus getDefault() { return sInstance; } private RxBus(); } | RxBus { public static RxBus getDefault() { return sInstance; } private RxBus(); static RxBus getDefault(); @SuppressWarnings("ConstantConditions") void post(@android.support.annotation.NonNull Event event); Observable<Event> register(@android.support.annotation.NonNull final String tag); Observable<Event> register(@an... | RxBus { public static RxBus getDefault() { return sInstance; } private RxBus(); static RxBus getDefault(); @SuppressWarnings("ConstantConditions") void post(@android.support.annotation.NonNull Event event); Observable<Event> register(@android.support.annotation.NonNull final String tag); Observable<Event> register(@an... |
@Test public void getPhone() throws Exception { BarcodeInfo.Phone phone = new BarcodeInfo.Phone("7894561230"); BarcodeInfo barcodeInfo = new BarcodeInfo(); barcodeInfo.setPhone(phone); assertEquals(barcodeInfo.getPhone(), phone); } | Phone getPhone() { return mPhone; } | BarcodeInfo { Phone getPhone() { return mPhone; } } | BarcodeInfo { Phone getPhone() { return mPhone; } } | BarcodeInfo { Phone getPhone() { return mPhone; } void setBoundingBox(Rect boundingBox); void setContact(Contact contact); void setUrlBookmark(UrlBookmark urlBookmark); void setSms(Sms sms); void setGeoPoint(GeoPoint geoPoint); void setCalendarEvent(CalendarEvent calendarEvent); void setPhone(Phone phone); void setRaw... | BarcodeInfo { Phone getPhone() { return mPhone; } void setBoundingBox(Rect boundingBox); void setContact(Contact contact); void setUrlBookmark(UrlBookmark urlBookmark); void setSms(Sms sms); void setGeoPoint(GeoPoint geoPoint); void setCalendarEvent(CalendarEvent calendarEvent); void setPhone(Phone phone); void setRaw... |
@Test public void getRawValue() throws Exception { BarcodeInfo barcodeInfo = new BarcodeInfo(); barcodeInfo.setRawValue("Raw value"); assertEquals(barcodeInfo.getRawValue(), "Raw value"); } | String getRawValue() { return mRawValue; } | BarcodeInfo { String getRawValue() { return mRawValue; } } | BarcodeInfo { String getRawValue() { return mRawValue; } } | BarcodeInfo { String getRawValue() { return mRawValue; } void setBoundingBox(Rect boundingBox); void setContact(Contact contact); void setUrlBookmark(UrlBookmark urlBookmark); void setSms(Sms sms); void setGeoPoint(GeoPoint geoPoint); void setCalendarEvent(CalendarEvent calendarEvent); void setPhone(Phone phone); void... | BarcodeInfo { String getRawValue() { return mRawValue; } void setBoundingBox(Rect boundingBox); void setContact(Contact contact); void setUrlBookmark(UrlBookmark urlBookmark); void setSms(Sms sms); void setGeoPoint(GeoPoint geoPoint); void setCalendarEvent(CalendarEvent calendarEvent); void setPhone(Phone phone); void... |
@SuppressWarnings("ConstantConditions") @Test public void postNull() throws Exception { try { mRxBus.post(null); fail(); } catch (IllegalArgumentException e) { } } | @SuppressWarnings("ConstantConditions") public void post(@android.support.annotation.NonNull Event event) { if (event == null) throw new IllegalArgumentException("Event cannot be null."); sBus.onNext(event); } | RxBus { @SuppressWarnings("ConstantConditions") public void post(@android.support.annotation.NonNull Event event) { if (event == null) throw new IllegalArgumentException("Event cannot be null."); sBus.onNext(event); } } | RxBus { @SuppressWarnings("ConstantConditions") public void post(@android.support.annotation.NonNull Event event) { if (event == null) throw new IllegalArgumentException("Event cannot be null."); sBus.onNext(event); } private RxBus(); } | RxBus { @SuppressWarnings("ConstantConditions") public void post(@android.support.annotation.NonNull Event event) { if (event == null) throw new IllegalArgumentException("Event cannot be null."); sBus.onNext(event); } private RxBus(); static RxBus getDefault(); @SuppressWarnings("ConstantConditions") void post(@androi... | RxBus { @SuppressWarnings("ConstantConditions") public void post(@android.support.annotation.NonNull Event event) { if (event == null) throw new IllegalArgumentException("Event cannot be null."); sBus.onNext(event); } private RxBus(); static RxBus getDefault(); @SuppressWarnings("ConstantConditions") void post(@androi... |
@Test public void getTag() throws Exception { String mockTag = "Test"; Event event = new Event(mockTag); assertEquals(event.getTag(), mockTag); Integer mockObj = 34; event = new Event(mockObj); assertEquals(event.getTag(), mockObj.getClass().getSimpleName()); } | @android.support.annotation.NonNull public String getTag() { return mTag; } | Event { @android.support.annotation.NonNull public String getTag() { return mTag; } } | Event { @android.support.annotation.NonNull public String getTag() { return mTag; } @SuppressWarnings("ConstantConditions") Event(@android.support.annotation.NonNull String tag); @SuppressWarnings("ConstantConditions") Event(@android.support.annotation.NonNull Object o); } | Event { @android.support.annotation.NonNull public String getTag() { return mTag; } @SuppressWarnings("ConstantConditions") Event(@android.support.annotation.NonNull String tag); @SuppressWarnings("ConstantConditions") Event(@android.support.annotation.NonNull Object o); @android.support.annotation.NonNull String get... | Event { @android.support.annotation.NonNull public String getTag() { return mTag; } @SuppressWarnings("ConstantConditions") Event(@android.support.annotation.NonNull String tag); @SuppressWarnings("ConstantConditions") Event(@android.support.annotation.NonNull Object o); @android.support.annotation.NonNull String get... |
@Test public void getObject() throws Exception { Integer mockObj = 34; Event event = new Event(mockObj); assertEquals(event.getObject(), mockObj); } | public Object getObject() { return mObject; } | Event { public Object getObject() { return mObject; } } | Event { public Object getObject() { return mObject; } @SuppressWarnings("ConstantConditions") Event(@android.support.annotation.NonNull String tag); @SuppressWarnings("ConstantConditions") Event(@android.support.annotation.NonNull Object o); } | Event { public Object getObject() { return mObject; } @SuppressWarnings("ConstantConditions") Event(@android.support.annotation.NonNull String tag); @SuppressWarnings("ConstantConditions") Event(@android.support.annotation.NonNull Object o); @android.support.annotation.NonNull String getTag(); Object getObject(); } | Event { public Object getObject() { return mObject; } @SuppressWarnings("ConstantConditions") Event(@android.support.annotation.NonNull String tag); @SuppressWarnings("ConstantConditions") Event(@android.support.annotation.NonNull Object o); @android.support.annotation.NonNull String getTag(); Object getObject(); } |
@SuppressWarnings("ConstantConditions") @Test public void checkLLabel() throws Exception { try { new InfoModel(null); fail(); } catch (IllegalArgumentException e) { } InfoModel infoModel = new InfoModel(MOCK_LABEL); assertEquals(infoModel.getLabel(), MOCK_LABEL); } | public String getLabel() { return label; } | InfoModel { public String getLabel() { return label; } } | InfoModel { public String getLabel() { return label; } InfoModel(@NonNull String label); } | InfoModel { public String getLabel() { return label; } InfoModel(@NonNull String label); String getInfo(); void setInfo(@NonNull String info); String getImageUrl(); void setImageUrl(String imageUrl); String getLabel(); } | InfoModel { public String getLabel() { return label; } InfoModel(@NonNull String label); String getInfo(); void setInfo(@NonNull String info); String getImageUrl(); void setImageUrl(String imageUrl); String getLabel(); } |
@Test public void getContact() throws Exception { BarcodeInfo.Contact contact = new BarcodeInfo.Contact(); BarcodeInfo barcodeInfo = new BarcodeInfo(); barcodeInfo.setContact(contact); assertEquals(barcodeInfo.getContact(), contact); } | Contact getContact() { return mContact; } | BarcodeInfo { Contact getContact() { return mContact; } } | BarcodeInfo { Contact getContact() { return mContact; } } | BarcodeInfo { Contact getContact() { return mContact; } void setBoundingBox(Rect boundingBox); void setContact(Contact contact); void setUrlBookmark(UrlBookmark urlBookmark); void setSms(Sms sms); void setGeoPoint(GeoPoint geoPoint); void setCalendarEvent(CalendarEvent calendarEvent); void setPhone(Phone phone); void ... | BarcodeInfo { Contact getContact() { return mContact; } void setBoundingBox(Rect boundingBox); void setContact(Contact contact); void setUrlBookmark(UrlBookmark urlBookmark); void setSms(Sms sms); void setGeoPoint(GeoPoint geoPoint); void setCalendarEvent(CalendarEvent calendarEvent); void setPhone(Phone phone); void ... |
@Test public void getUrlBookmark() throws Exception { BarcodeInfo.UrlBookmark urlBookmark = new BarcodeInfo.UrlBookmark("Google", "www.google.com"); BarcodeInfo barcodeInfo = new BarcodeInfo(); barcodeInfo.setUrlBookmark(urlBookmark); assertEquals(barcodeInfo.getUrlBookmark(), urlBookmark); } | UrlBookmark getUrlBookmark() { return mUrlBookmark; } | BarcodeInfo { UrlBookmark getUrlBookmark() { return mUrlBookmark; } } | BarcodeInfo { UrlBookmark getUrlBookmark() { return mUrlBookmark; } } | BarcodeInfo { UrlBookmark getUrlBookmark() { return mUrlBookmark; } void setBoundingBox(Rect boundingBox); void setContact(Contact contact); void setUrlBookmark(UrlBookmark urlBookmark); void setSms(Sms sms); void setGeoPoint(GeoPoint geoPoint); void setCalendarEvent(CalendarEvent calendarEvent); void setPhone(Phone p... | BarcodeInfo { UrlBookmark getUrlBookmark() { return mUrlBookmark; } void setBoundingBox(Rect boundingBox); void setContact(Contact contact); void setUrlBookmark(UrlBookmark urlBookmark); void setSms(Sms sms); void setGeoPoint(GeoPoint geoPoint); void setCalendarEvent(CalendarEvent calendarEvent); void setPhone(Phone p... |
@Test public void getSms() throws Exception { BarcodeInfo.Sms sms = new BarcodeInfo.Sms("This is test message.", "1234567890"); BarcodeInfo info = new BarcodeInfo(); info.setSms(sms); assertEquals(info.getSms(), sms); } | Sms getSms() { return mSms; } | BarcodeInfo { Sms getSms() { return mSms; } } | BarcodeInfo { Sms getSms() { return mSms; } } | BarcodeInfo { Sms getSms() { return mSms; } void setBoundingBox(Rect boundingBox); void setContact(Contact contact); void setUrlBookmark(UrlBookmark urlBookmark); void setSms(Sms sms); void setGeoPoint(GeoPoint geoPoint); void setCalendarEvent(CalendarEvent calendarEvent); void setPhone(Phone phone); void setRawValue(... | BarcodeInfo { Sms getSms() { return mSms; } void setBoundingBox(Rect boundingBox); void setContact(Contact contact); void setUrlBookmark(UrlBookmark urlBookmark); void setSms(Sms sms); void setGeoPoint(GeoPoint geoPoint); void setCalendarEvent(CalendarEvent calendarEvent); void setPhone(Phone phone); void setRawValue(... |
@Test public void getGeoPoint() throws Exception { BarcodeInfo.GeoPoint geoPoint = new BarcodeInfo.GeoPoint(23.0225, 72.5714); BarcodeInfo info = new BarcodeInfo(); info.setGeoPoint(geoPoint); assertEquals(info.getGeoPoint(), geoPoint); } | GeoPoint getGeoPoint() { return mGeoPoint; } | BarcodeInfo { GeoPoint getGeoPoint() { return mGeoPoint; } } | BarcodeInfo { GeoPoint getGeoPoint() { return mGeoPoint; } } | BarcodeInfo { GeoPoint getGeoPoint() { return mGeoPoint; } void setBoundingBox(Rect boundingBox); void setContact(Contact contact); void setUrlBookmark(UrlBookmark urlBookmark); void setSms(Sms sms); void setGeoPoint(GeoPoint geoPoint); void setCalendarEvent(CalendarEvent calendarEvent); void setPhone(Phone phone); vo... | BarcodeInfo { GeoPoint getGeoPoint() { return mGeoPoint; } void setBoundingBox(Rect boundingBox); void setContact(Contact contact); void setUrlBookmark(UrlBookmark urlBookmark); void setSms(Sms sms); void setGeoPoint(GeoPoint geoPoint); void setCalendarEvent(CalendarEvent calendarEvent); void setPhone(Phone phone); vo... |
@Test public void getCalendarEvent() throws Exception { BarcodeInfo.CalendarEvent calendarEvent = new BarcodeInfo.CalendarEvent(); BarcodeInfo barcodeInfo = new BarcodeInfo(); barcodeInfo.setCalendarEvent(calendarEvent); assertEquals(barcodeInfo.getCalendarEvent(), calendarEvent); } | CalendarEvent getCalendarEvent() { return mCalendarEvent; } | BarcodeInfo { CalendarEvent getCalendarEvent() { return mCalendarEvent; } } | BarcodeInfo { CalendarEvent getCalendarEvent() { return mCalendarEvent; } } | BarcodeInfo { CalendarEvent getCalendarEvent() { return mCalendarEvent; } void setBoundingBox(Rect boundingBox); void setContact(Contact contact); void setUrlBookmark(UrlBookmark urlBookmark); void setSms(Sms sms); void setGeoPoint(GeoPoint geoPoint); void setCalendarEvent(CalendarEvent calendarEvent); void setPhone(P... | BarcodeInfo { CalendarEvent getCalendarEvent() { return mCalendarEvent; } void setBoundingBox(Rect boundingBox); void setContact(Contact contact); void setUrlBookmark(UrlBookmark urlBookmark); void setSms(Sms sms); void setGeoPoint(GeoPoint geoPoint); void setCalendarEvent(CalendarEvent calendarEvent); void setPhone(P... |
@Test public void shouldFindImplementation() { Class<? extends DummyComponent> clazz = ClasspathUtils .findImplementationClass(DummyComponent.class); assertEquals(clazz, DummyComponentImpl.class); } | @SuppressWarnings("unchecked") public static <T> Class<? extends T> findImplementationClass(Class<T> clazz) { if (!Modifier.isAbstract(clazz.getModifiers())) return clazz; String implementationClass = String.format("%s.impl.%sImpl", clazz.getPackage().getName(), clazz.getSimpleName()); try { return (Class<? extends T>)... | ClasspathUtils { @SuppressWarnings("unchecked") public static <T> Class<? extends T> findImplementationClass(Class<T> clazz) { if (!Modifier.isAbstract(clazz.getModifiers())) return clazz; String implementationClass = String.format("%s.impl.%sImpl", clazz.getPackage().getName(), clazz.getSimpleName()); try { return (Cl... | ClasspathUtils { @SuppressWarnings("unchecked") public static <T> Class<? extends T> findImplementationClass(Class<T> clazz) { if (!Modifier.isAbstract(clazz.getModifiers())) return clazz; String implementationClass = String.format("%s.impl.%sImpl", clazz.getPackage().getName(), clazz.getSimpleName()); try { return (Cl... | ClasspathUtils { @SuppressWarnings("unchecked") public static <T> Class<? extends T> findImplementationClass(Class<T> clazz) { if (!Modifier.isAbstract(clazz.getModifiers())) return clazz; String implementationClass = String.format("%s.impl.%sImpl", clazz.getPackage().getName(), clazz.getSimpleName()); try { return (Cl... | ClasspathUtils { @SuppressWarnings("unchecked") public static <T> Class<? extends T> findImplementationClass(Class<T> clazz) { if (!Modifier.isAbstract(clazz.getModifiers())) return clazz; String implementationClass = String.format("%s.impl.%sImpl", clazz.getPackage().getName(), clazz.getSimpleName()); try { return (Cl... |
@Test(expectedExceptions = RuntimeException.class) public void shouldThrowExceptionWhenNoImplementationIsFound() { ClasspathUtils.findImplementationClass(List.class); } | @SuppressWarnings("unchecked") public static <T> Class<? extends T> findImplementationClass(Class<T> clazz) { if (!Modifier.isAbstract(clazz.getModifiers())) return clazz; String implementationClass = String.format("%s.impl.%sImpl", clazz.getPackage().getName(), clazz.getSimpleName()); try { return (Class<? extends T>)... | ClasspathUtils { @SuppressWarnings("unchecked") public static <T> Class<? extends T> findImplementationClass(Class<T> clazz) { if (!Modifier.isAbstract(clazz.getModifiers())) return clazz; String implementationClass = String.format("%s.impl.%sImpl", clazz.getPackage().getName(), clazz.getSimpleName()); try { return (Cl... | ClasspathUtils { @SuppressWarnings("unchecked") public static <T> Class<? extends T> findImplementationClass(Class<T> clazz) { if (!Modifier.isAbstract(clazz.getModifiers())) return clazz; String implementationClass = String.format("%s.impl.%sImpl", clazz.getPackage().getName(), clazz.getSimpleName()); try { return (Cl... | ClasspathUtils { @SuppressWarnings("unchecked") public static <T> Class<? extends T> findImplementationClass(Class<T> clazz) { if (!Modifier.isAbstract(clazz.getModifiers())) return clazz; String implementationClass = String.format("%s.impl.%sImpl", clazz.getPackage().getName(), clazz.getSimpleName()); try { return (Cl... | ClasspathUtils { @SuppressWarnings("unchecked") public static <T> Class<? extends T> findImplementationClass(Class<T> clazz) { if (!Modifier.isAbstract(clazz.getModifiers())) return clazz; String implementationClass = String.format("%s.impl.%sImpl", clazz.getPackage().getName(), clazz.getSimpleName()); try { return (Cl... |
@Test public void shouldCreatePageWithWebDriverConstructorAndInitElements() { DummyPageWithWebDriverConstructor page = WisePageFactory.initElements( this.driver, DummyPageWithWebDriverConstructor.class); assertNotNull(page.getDummyComponent()); } | public static <T> T initElements(WebDriver driver, Class<T> clazz) { T instance = instantiatePage(driver, clazz); return initElements(driver, instance); } | WisePageFactory { public static <T> T initElements(WebDriver driver, Class<T> clazz) { T instance = instantiatePage(driver, clazz); return initElements(driver, instance); } } | WisePageFactory { public static <T> T initElements(WebDriver driver, Class<T> clazz) { T instance = instantiatePage(driver, clazz); return initElements(driver, instance); } private WisePageFactory(); } | WisePageFactory { public static <T> T initElements(WebDriver driver, Class<T> clazz) { T instance = instantiatePage(driver, clazz); return initElements(driver, instance); } private WisePageFactory(); static T initElements(WebDriver driver, Class<T> clazz); static T initElements(SearchContext searchContext, T instance)... | WisePageFactory { public static <T> T initElements(WebDriver driver, Class<T> clazz) { T instance = instantiatePage(driver, clazz); return initElements(driver, instance); } private WisePageFactory(); static T initElements(WebDriver driver, Class<T> clazz); static T initElements(SearchContext searchContext, T instance)... |
@Test public void shouldCreatePageWithNoArgConstructorAndInitElements() { DummyPageWithNoArgConstructor page = WisePageFactory.initElements(this.driver, DummyPageWithNoArgConstructor.class); assertNotNull(page.getDummyComponent()); } | public static <T> T initElements(WebDriver driver, Class<T> clazz) { T instance = instantiatePage(driver, clazz); return initElements(driver, instance); } | WisePageFactory { public static <T> T initElements(WebDriver driver, Class<T> clazz) { T instance = instantiatePage(driver, clazz); return initElements(driver, instance); } } | WisePageFactory { public static <T> T initElements(WebDriver driver, Class<T> clazz) { T instance = instantiatePage(driver, clazz); return initElements(driver, instance); } private WisePageFactory(); } | WisePageFactory { public static <T> T initElements(WebDriver driver, Class<T> clazz) { T instance = instantiatePage(driver, clazz); return initElements(driver, instance); } private WisePageFactory(); static T initElements(WebDriver driver, Class<T> clazz); static T initElements(SearchContext searchContext, T instance)... | WisePageFactory { public static <T> T initElements(WebDriver driver, Class<T> clazz) { T instance = instantiatePage(driver, clazz); return initElements(driver, instance); } private WisePageFactory(); static T initElements(WebDriver driver, Class<T> clazz); static T initElements(SearchContext searchContext, T instance)... |
@Test public void shouldInitElementsOfInstance() { DummyPageWithWebDriverConstructor page = new DummyPageWithWebDriverConstructor(this.driver); WisePageFactory.initElements(this.driver, page); assertNotNull(page.getDummyComponent()); } | public static <T> T initElements(WebDriver driver, Class<T> clazz) { T instance = instantiatePage(driver, clazz); return initElements(driver, instance); } | WisePageFactory { public static <T> T initElements(WebDriver driver, Class<T> clazz) { T instance = instantiatePage(driver, clazz); return initElements(driver, instance); } } | WisePageFactory { public static <T> T initElements(WebDriver driver, Class<T> clazz) { T instance = instantiatePage(driver, clazz); return initElements(driver, instance); } private WisePageFactory(); } | WisePageFactory { public static <T> T initElements(WebDriver driver, Class<T> clazz) { T instance = instantiatePage(driver, clazz); return initElements(driver, instance); } private WisePageFactory(); static T initElements(WebDriver driver, Class<T> clazz); static T initElements(SearchContext searchContext, T instance)... | WisePageFactory { public static <T> T initElements(WebDriver driver, Class<T> clazz) { T instance = instantiatePage(driver, clazz); return initElements(driver, instance); } private WisePageFactory(); static T initElements(WebDriver driver, Class<T> clazz); static T initElements(SearchContext searchContext, T instance)... |
@Test(expectedExceptions = PageInstantiationException.class) public void shouldThrowExceptionWhileInstantiatingPageWithoutProperConstructor() { WisePageFactory.initElements(this.driver, DummyPageWithoutProperConstructor.class); } | public static <T> T initElements(WebDriver driver, Class<T> clazz) { T instance = instantiatePage(driver, clazz); return initElements(driver, instance); } | WisePageFactory { public static <T> T initElements(WebDriver driver, Class<T> clazz) { T instance = instantiatePage(driver, clazz); return initElements(driver, instance); } } | WisePageFactory { public static <T> T initElements(WebDriver driver, Class<T> clazz) { T instance = instantiatePage(driver, clazz); return initElements(driver, instance); } private WisePageFactory(); } | WisePageFactory { public static <T> T initElements(WebDriver driver, Class<T> clazz) { T instance = instantiatePage(driver, clazz); return initElements(driver, instance); } private WisePageFactory(); static T initElements(WebDriver driver, Class<T> clazz); static T initElements(SearchContext searchContext, T instance)... | WisePageFactory { public static <T> T initElements(WebDriver driver, Class<T> clazz) { T instance = instantiatePage(driver, clazz); return initElements(driver, instance); } private WisePageFactory(); static T initElements(WebDriver driver, Class<T> clazz); static T initElements(SearchContext searchContext, T instance)... |
@Test public void shouldFindElement() { DummyComponent select = Wiselenium.findElement(DummyComponent.class, BY_SELECT1, this.driver); assertNotNull(select); } | public static <E> E findElement(Class<E> clazz, By by, SearchContext searchContext) { WebElement webElement = searchContext.findElement(by); return decorateElement(clazz, webElement); } | Wiselenium { public static <E> E findElement(Class<E> clazz, By by, SearchContext searchContext) { WebElement webElement = searchContext.findElement(by); return decorateElement(clazz, webElement); } } | Wiselenium { public static <E> E findElement(Class<E> clazz, By by, SearchContext searchContext) { WebElement webElement = searchContext.findElement(by); return decorateElement(clazz, webElement); } private Wiselenium(); } | Wiselenium { public static <E> E findElement(Class<E> clazz, By by, SearchContext searchContext) { WebElement webElement = searchContext.findElement(by); return decorateElement(clazz, webElement); } private Wiselenium(); static E findElement(Class<E> clazz, By by, SearchContext searchContext); static List<E> findEleme... | Wiselenium { public static <E> E findElement(Class<E> clazz, By by, SearchContext searchContext) { WebElement webElement = searchContext.findElement(by); return decorateElement(clazz, webElement); } private Wiselenium(); static E findElement(Class<E> clazz, By by, SearchContext searchContext); static List<E> findEleme... |
@SuppressWarnings("null") @Test public void shouldFindElements() { List<DummyComponent> elements = Wiselenium.findElements( DummyComponent.class, BY_RADIOBUTTON, this.driver); assertTrue(elements != null && !elements.isEmpty()); for (DummyComponent element : elements) { assertNotNull(element); } } | public static <E> List<E> findElements(Class<E> clazz, By by, SearchContext searchContext) { List<WebElement> webElements = searchContext.findElements(by); if (webElements.isEmpty()) return Lists.newArrayList(); WiseDecorator decorator = new WiseDecorator(new DefaultElementLocatorFactory(searchContext)); return decorat... | Wiselenium { public static <E> List<E> findElements(Class<E> clazz, By by, SearchContext searchContext) { List<WebElement> webElements = searchContext.findElements(by); if (webElements.isEmpty()) return Lists.newArrayList(); WiseDecorator decorator = new WiseDecorator(new DefaultElementLocatorFactory(searchContext)); r... | Wiselenium { public static <E> List<E> findElements(Class<E> clazz, By by, SearchContext searchContext) { List<WebElement> webElements = searchContext.findElements(by); if (webElements.isEmpty()) return Lists.newArrayList(); WiseDecorator decorator = new WiseDecorator(new DefaultElementLocatorFactory(searchContext)); r... | Wiselenium { public static <E> List<E> findElements(Class<E> clazz, By by, SearchContext searchContext) { List<WebElement> webElements = searchContext.findElements(by); if (webElements.isEmpty()) return Lists.newArrayList(); WiseDecorator decorator = new WiseDecorator(new DefaultElementLocatorFactory(searchContext)); r... | Wiselenium { public static <E> List<E> findElements(Class<E> clazz, By by, SearchContext searchContext) { List<WebElement> webElements = searchContext.findElements(by); if (webElements.isEmpty()) return Lists.newArrayList(); WiseDecorator decorator = new WiseDecorator(new DefaultElementLocatorFactory(searchContext)); r... |
@Test public void shouldReturnEmptyListWhenElementsAreNotFound() { List<DummyComponent> selects = Wiselenium.findElements( DummyComponent.class, By.id("inexistent"), this.driver); assertTrue(selects != null && selects.isEmpty()); } | public static <E> List<E> findElements(Class<E> clazz, By by, SearchContext searchContext) { List<WebElement> webElements = searchContext.findElements(by); if (webElements.isEmpty()) return Lists.newArrayList(); WiseDecorator decorator = new WiseDecorator(new DefaultElementLocatorFactory(searchContext)); return decorat... | Wiselenium { public static <E> List<E> findElements(Class<E> clazz, By by, SearchContext searchContext) { List<WebElement> webElements = searchContext.findElements(by); if (webElements.isEmpty()) return Lists.newArrayList(); WiseDecorator decorator = new WiseDecorator(new DefaultElementLocatorFactory(searchContext)); r... | Wiselenium { public static <E> List<E> findElements(Class<E> clazz, By by, SearchContext searchContext) { List<WebElement> webElements = searchContext.findElements(by); if (webElements.isEmpty()) return Lists.newArrayList(); WiseDecorator decorator = new WiseDecorator(new DefaultElementLocatorFactory(searchContext)); r... | Wiselenium { public static <E> List<E> findElements(Class<E> clazz, By by, SearchContext searchContext) { List<WebElement> webElements = searchContext.findElements(by); if (webElements.isEmpty()) return Lists.newArrayList(); WiseDecorator decorator = new WiseDecorator(new DefaultElementLocatorFactory(searchContext)); r... | Wiselenium { public static <E> List<E> findElements(Class<E> clazz, By by, SearchContext searchContext) { List<WebElement> webElements = searchContext.findElements(by); if (webElements.isEmpty()) return Lists.newArrayList(); WiseDecorator decorator = new WiseDecorator(new DefaultElementLocatorFactory(searchContext)); r... |
@Test(expectedExceptions = NoSuchElementException.class) public void shouldThrowExceptionWhenElementIsntFound() { Wiselenium.findElement(DummyComponent.class, By.id("inexistent"), this.driver); } | public static <E> E findElement(Class<E> clazz, By by, SearchContext searchContext) { WebElement webElement = searchContext.findElement(by); return decorateElement(clazz, webElement); } | Wiselenium { public static <E> E findElement(Class<E> clazz, By by, SearchContext searchContext) { WebElement webElement = searchContext.findElement(by); return decorateElement(clazz, webElement); } } | Wiselenium { public static <E> E findElement(Class<E> clazz, By by, SearchContext searchContext) { WebElement webElement = searchContext.findElement(by); return decorateElement(clazz, webElement); } private Wiselenium(); } | Wiselenium { public static <E> E findElement(Class<E> clazz, By by, SearchContext searchContext) { WebElement webElement = searchContext.findElement(by); return decorateElement(clazz, webElement); } private Wiselenium(); static E findElement(Class<E> clazz, By by, SearchContext searchContext); static List<E> findEleme... | Wiselenium { public static <E> E findElement(Class<E> clazz, By by, SearchContext searchContext) { WebElement webElement = searchContext.findElement(by); return decorateElement(clazz, webElement); } private Wiselenium(); static E findElement(Class<E> clazz, By by, SearchContext searchContext); static List<E> findEleme... |
@Test public void peek() throws Exception { Reader in = new StringReader("I see you"); LexerStream ls = new LexerStream(in); assertEquals(1, ls.getLine()); assertEquals(1, ls.getCol()); int c = ls.peek(); assertEquals('I', (char)c); assertTrue(1 == ls.getLine() && 1 == ls.getCol()); c = ls.peek(2); assertEquals(' ', (c... | public int peek() throws IOException { super.mark(1); int c = super.read(); super.reset(); return c; } | LexerStream extends LineNumberReader { public int peek() throws IOException { super.mark(1); int c = super.read(); super.reset(); return c; } } | LexerStream extends LineNumberReader { public int peek() throws IOException { super.mark(1); int c = super.read(); super.reset(); return c; } LexerStream(Reader in_stream); } | LexerStream extends LineNumberReader { public int peek() throws IOException { super.mark(1); int c = super.read(); super.reset(); return c; } LexerStream(Reader in_stream); int getLine(); int getCol(); int getPosition(); @Override int read(); @Override String readLine(); int peek(); int peek(int ahead); @Override int r... | LexerStream extends LineNumberReader { public int peek() throws IOException { super.mark(1); int c = super.read(); super.reset(); return c; } LexerStream(Reader in_stream); int getLine(); int getCol(); int getPosition(); @Override int read(); @Override String readLine(); int peek(); int peek(int ahead); @Override int r... |
@Test public void chars() throws Exception { String str = "'a' '\\n' '' '\\t'"; LexerStream ls = new LexerStream(new StringReader(str)); LexCharLiteral lex = new LexCharLiteral(new BaseTokenFactory(), ls); Token tok = lex.read(); assertEquals(TokenType.LiteralChar, tok.getType()); assertEquals("a", tok.getValue()); ass... | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int code_point; int next = in_stream.peek(); if (next != '\'') { throw new LexerException(start_line, start_col, "Not a character literal"); } in_... | LexCharLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int code_point; int next = in_stream.peek(); if (next != '\'') { throw new LexerException(start_line, start_col, "Not a character... | LexCharLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int code_point; int next = in_stream.peek(); if (next != '\'') { throw new LexerException(start_line, start_col, "Not a character... | LexCharLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int code_point; int next = in_stream.peek(); if (next != '\'') { throw new LexerException(start_line, start_col, "Not a character... | LexCharLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int code_point; int next = in_stream.peek(); if (next != '\'') { throw new LexerException(start_line, start_col, "Not a character... |
@Test public void normal() throws Exception { String str = "q\"!foo!\""; LexerStream ls = new LexerStream(new StringReader(str)); LexDelimitedString lex = new LexDelimitedString(new BaseTokenFactory(), ls); Token tok = lex.read(); Assert.assertEquals(TokenType.LiteralUtf8, tok.getType()); assertTrue(tok.getValue() inst... | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream when parsing delimi... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... |
@Test public void bracketed() throws Exception { String str = "q\"{foo][{b}f}\"bar"; LexerStream ls = new LexerStream(new StringReader(str)); LexDelimitedString lex = new LexDelimitedString(new BaseTokenFactory(), ls); Token tok = lex.read(); Assert.assertEquals(TokenType.LiteralUtf8, tok.getType()); assertTrue(tok.get... | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream when parsing delimi... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... |
@Test public void parens() throws Exception { String str = "q\"((f)\""; LexerStream ls = new LexerStream(new StringReader(str)); LexDelimitedString lex = new LexDelimitedString(new BaseTokenFactory(), ls); Token tok = lex.read(); Assert.assertEquals(TokenType.LiteralUtf8, tok.getType()); assertTrue(tok.getValue() insta... | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream when parsing delimi... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... |
@Test public void identifier() throws Exception { String str = "q\"END\nsome\nmultiline\nstring\nEND\" "; LexerStream ls = new LexerStream(new StringReader(str)); LexDelimitedString lex = new LexDelimitedString(new BaseTokenFactory(), ls); Token tok = lex.read(); Assert.assertEquals(TokenType.LiteralUtf8, tok.getType()... | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream when parsing delimi... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... |
@Test(expected = LexerException.class) public void empty() throws Exception { String str = ""; LexerStream ls = new LexerStream(new StringReader(str)); LexDelimitedString lex = new LexDelimitedString(new BaseTokenFactory(), ls); lex.read(); } | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream when parsing delimi... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... |
@Test(expected = LexerException.class) public void not() throws Exception { String str = "q[]"; LexerStream ls = new LexerStream(new StringReader(str)); LexDelimitedString lex = new LexDelimitedString(new BaseTokenFactory(), ls); lex.read(); } | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream when parsing delimi... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... |
@Test(expected = LexerException.class) public void also_not() throws Exception { String str = "\"q{}\""; LexerStream ls = new LexerStream(new StringReader(str)); LexDelimitedString lex = new LexDelimitedString(new BaseTokenFactory(), ls); lex.read(); } | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream when parsing delimi... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... |
@Test(expected = LexerException.class) public void unterminated() throws Exception { String str = "q\"{lalala}"; LexerStream ls = new LexerStream(new StringReader(str)); LexDelimitedString lex = new LexDelimitedString(new BaseTokenFactory(), ls); lex.read(); } | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream when parsing delimi... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... |
@Test(expected = LexerException.class) public void partial_delimiter() throws Exception { String str = "q\"/abc/def/\""; LexerStream ls = new LexerStream(new StringReader(str)); LexDelimitedString lex = new LexDelimitedString(new BaseTokenFactory(), ls); lex.read(); } | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream when parsing delimi... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... |
@Test public void readLine() throws Exception { Reader in = new StringReader("line1\nline2\n3line\n\nline5"); LexerStream ls = new LexerStream(in); assertEquals(1, ls.getLine()); assertEquals(1, ls.getCol()); assertEquals('l', (char)ls.read()); assertEquals(1, ls.getLine()); assertEquals(2, ls.getCol()); assertEquals("... | @Override public String readLine() throws IOException { String ln = super.readLine(); if (ln != null) { index += ln.length(); } line = super.getLineNumber(); col = 1; return ln; } | LexerStream extends LineNumberReader { @Override public String readLine() throws IOException { String ln = super.readLine(); if (ln != null) { index += ln.length(); } line = super.getLineNumber(); col = 1; return ln; } } | LexerStream extends LineNumberReader { @Override public String readLine() throws IOException { String ln = super.readLine(); if (ln != null) { index += ln.length(); } line = super.getLineNumber(); col = 1; return ln; } LexerStream(Reader in_stream); } | LexerStream extends LineNumberReader { @Override public String readLine() throws IOException { String ln = super.readLine(); if (ln != null) { index += ln.length(); } line = super.getLineNumber(); col = 1; return ln; } LexerStream(Reader in_stream); int getLine(); int getCol(); int getPosition(); @Override int read(); ... | LexerStream extends LineNumberReader { @Override public String readLine() throws IOException { String ln = super.readLine(); if (ln != null) { index += ln.length(); } line = super.getLineNumber(); col = 1; return ln; } LexerStream(Reader in_stream); int getLine(); int getCol(); int getPosition(); @Override int read(); ... |
@Test(expected = LexerException.class) public void unnested() throws Exception { String str = "q\"{foo][}f}\"bar"; LexerStream ls = new LexerStream(new StringReader(str)); LexDelimitedString lex = new LexDelimitedString(new BaseTokenFactory(), ls); lex.read(); } | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream when parsing delimi... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... | LexDelimitedString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input strea... |
@Test public void simple() throws Exception { String str = "x\"0A\""; StringBuilder sb = new StringBuilder(); sb.append(Character.toChars(0x0a)); String expected = sb.toString(); LexerStream ls = new LexerStream(new StringReader(str)); LexHexLiteral lex = new LexHexLiteral(new BaseTokenFactory(), ls); Token tok = lex.r... | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream when parsing string... | LexHexLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... | LexHexLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... | LexHexLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... | LexHexLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... |
@Test public void spaces() throws Exception { String str = "x\"00 FbcD 3 2FD 0A \""; StringBuilder sb = new StringBuilder(); sb.append(Character.toChars(0x00)); sb.append(Character.toChars(0xfb)); sb.append(Character.toChars(0xcd)); sb.append(Character.toChars(0x32)); sb.append(Character.toChars(0xfd)); sb.append(Chara... | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream when parsing string... | LexHexLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... | LexHexLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... | LexHexLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... | LexHexLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... |
@Test(expected = LexerException.class) public void empty() throws Exception { String str = ""; LexerStream ls = new LexerStream(new StringReader(str)); LexHexLiteral lex = new LexHexLiteral(new BaseTokenFactory(), ls); lex.read(); } | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream when parsing string... | LexHexLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... | LexHexLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... | LexHexLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... | LexHexLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... |
@Test(expected = LexerException.class) public void not() throws Exception { String str = "hex string"; LexerStream ls = new LexerStream(new StringReader(str)); LexHexLiteral lex = new LexHexLiteral(new BaseTokenFactory(), ls); lex.read(); } | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream when parsing string... | LexHexLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... | LexHexLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... | LexHexLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... | LexHexLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... |
@Test(expected = LexerException.class) public void also_not() throws Exception { String str = "x00AB"; LexerStream ls = new LexerStream(new StringReader(str)); LexHexLiteral lex = new LexHexLiteral(new BaseTokenFactory(), ls); lex.read(); } | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream when parsing string... | LexHexLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... | LexHexLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... | LexHexLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... | LexHexLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... |
@Test(expected = LexerException.class) public void unterminated() throws Exception { String str = "x\"AB CD"; LexerStream ls = new LexerStream(new StringReader(str)); LexHexLiteral lex = new LexHexLiteral(new BaseTokenFactory(), ls); lex.read(); } | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream when parsing string... | LexHexLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... | LexHexLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... | LexHexLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... | LexHexLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... |
@Test public void not_op() throws Exception { String str = "foo"; LexerStream ls = new LexerStream(new StringReader(str)); LexOperator lex = new LexOperator(new BaseTokenFactory(), ls); Token tok = lex.read(); assertNull(tok); lex = new LexOperator(new BaseTokenFactory(), new LexerStream(new StringReader(""))); try { t... | public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when parsing operat... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... |
@Test public void assign() throws Exception { String str = "a=b"; LexerStream ls = new LexerStream(new StringReader(str)); LexOperator lex = new LexOperator(new BaseTokenFactory(), ls); ls.read(); Token tok = lex.read(); assertEquals(TokenType.Assign, tok.getType()); assertEquals("=", tok.getValue()); assertEquals(1, t... | public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when parsing operat... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... |
@Test public void equality() throws Exception { String str = "a==b != c"; LexerStream ls = new LexerStream(new StringReader(str)); LexOperator lex = new LexOperator(new BaseTokenFactory(), ls); ls.read(); Token tok = lex.read(); assertEquals(TokenType.Equal, tok.getType()); assertEquals("==", tok.getValue()); assertEqu... | public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when parsing operat... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... |
@Test public void keywords() throws Exception { StringBuilder words = new StringBuilder(); for (String word : keywords) { words.append(word).append(" "); } LexerStream ls = new LexerStream(new StringReader(words.toString())); LexIdentifier lex = new LexIdentifier(new BaseTokenFactory(), ls); for (String word : keywords... | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream when parsing identi... | LexIdentifier { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... | LexIdentifier { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... | LexIdentifier { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... | LexIdentifier { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... |
@Test public void inequality() throws Exception { String str = "a<b>c<=d>=e<>d<>=e"; LexerStream ls = new LexerStream(new StringReader(str)); LexOperator lex = new LexOperator(new BaseTokenFactory(), ls); ls.read(); Token tok = lex.read(); assertEquals(TokenType.LessThan, tok.getType()); assertEquals("<", tok.getValue(... | public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when parsing operat... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... |
@Test public void add() throws Exception { String str = "+ w++ += f"; LexerStream ls = new LexerStream(new StringReader(str)); LexOperator lex = new LexOperator(new BaseTokenFactory(), ls); Token tok = lex.read(); assertEquals(TokenType.Plus, tok.getType()); assertEquals(1, tok.getLine()); assertEquals(1, tok.getCol())... | public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when parsing operat... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... |
@Test public void sub() throws Exception { String str = "a-=b-- -c"; LexerStream ls = new LexerStream(new StringReader(str)); LexOperator lex = new LexOperator(new BaseTokenFactory(), ls); ls.read(); Token tok = lex.read(); assertEquals(TokenType.MinusAssign, tok.getType()); assertEquals(1, tok.getLine()); assertEquals... | public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when parsing operat... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... |
@Test public void mul() throws Exception { String str = "a *=b*c;"; LexerStream ls = new LexerStream(new StringReader(str)); LexOperator lex = new LexOperator(new BaseTokenFactory(), ls); ls.read(); ls.read(); Token tok = lex.read(); assertEquals(TokenType.TimesAssign, tok.getType()); assertEquals(1, tok.getLine()); as... | public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when parsing operat... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... |
@Test public void div() throws Exception { String str = "a/=b/c;"; LexerStream ls = new LexerStream(new StringReader(str)); LexOperator lex = new LexOperator(new BaseTokenFactory(), ls); ls.read(); Token tok = lex.read(); assertEquals(TokenType.DivAssign, tok.getType()); assertEquals(1, tok.getLine()); assertEquals(2, ... | public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when parsing operat... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... |
@Test public void mod() throws Exception { String str = "a%=b%c;"; LexerStream ls = new LexerStream(new StringReader(str)); LexOperator lex = new LexOperator(new BaseTokenFactory(), ls); ls.read(); Token tok = lex.read(); assertEquals(TokenType.ModAssign, tok.getType()); assertEquals(1, tok.getLine()); assertEquals(2, ... | public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when parsing operat... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... |
@Test public void bitwise() throws Exception { String str = "a&=b|c|=d&e^=f^g;"; LexerStream ls = new LexerStream(new StringReader(str)); LexOperator lex = new LexOperator(new BaseTokenFactory(), ls); ls.read(); Token tok = lex.read(); assertEquals(TokenType.BitwiseAndAssign, tok.getType()); assertEquals(1, tok.getLine... | public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when parsing operat... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... |
@Test public void logical() throws Exception { String str = "a&&b ||!c;"; LexerStream ls = new LexerStream(new StringReader(str)); LexOperator lex = new LexOperator(new BaseTokenFactory(), ls); ls.read(); Token tok = lex.read(); assertEquals(TokenType.LogicalAnd, tok.getType()); assertEquals(1, tok.getLine()); assertEq... | public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when parsing operat... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... |
@Test public void pow() throws Exception { String str = "a^^=b^^c;"; LexerStream ls = new LexerStream(new StringReader(str)); LexOperator lex = new LexOperator(new BaseTokenFactory(), ls); ls.read(); Token tok = lex.read(); assertEquals(TokenType.PowAssign, tok.getType()); assertEquals(1, tok.getLine()); assertEquals(2... | public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when parsing operat... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... |
@Test public void unordered() throws Exception { String str = "a !< b !<> c !<>= d !<= e !> f !>= g"; LexerStream ls = new LexerStream(new StringReader(str)); LexOperator lex = new LexOperator(new BaseTokenFactory(), ls); ls.read(); ls.read(); Token tok = lex.read(); assertEquals(TokenType.UnorderedGreaterOrEqual, tok.... | public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when parsing operat... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... |
@Test public void identifier() throws Exception { String str = "foo _bar a_2"; LexerStream ls = new LexerStream(new StringReader(str)); LexIdentifier lex = new LexIdentifier(new BaseTokenFactory(), ls); Token tok = lex.read(); assertEquals(TokenType.Identifier, tok.getType()); assertEquals("foo", tok.getValue()); asser... | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream when parsing identi... | LexIdentifier { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... | LexIdentifier { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... | LexIdentifier { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... | LexIdentifier { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... |
@Test public void tilde() throws Exception { String str = "a~=b~c;"; LexerStream ls = new LexerStream(new StringReader(str)); LexOperator lex = new LexOperator(new BaseTokenFactory(), ls); ls.read(); Token tok = lex.read(); assertEquals(TokenType.TildeAssign, tok.getType()); assertTrue(tok.getLine() == 1 && tok.getEndL... | public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when parsing operat... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... |
@Test public void eleven() throws Exception { String str = "v=>11;"; LexerStream ls = new LexerStream(new StringReader(str)); LexOperator lex = new LexOperator(new BaseTokenFactory(), ls); ls.read(); Token tok = lex.read(); assertEquals(TokenType.GoesTo, tok.getType()); assertTrue(tok.getLine() == 1 && tok.getEndLine()... | public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when parsing operat... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... |
@Test public void shift() throws Exception { String str = "a<<b>>c<<=d>>=e"; LexerStream ls = new LexerStream(new StringReader(str)); LexOperator lex = new LexOperator(new BaseTokenFactory(), ls); ls.read(); Token tok = lex.read(); assertEquals(TokenType.ShiftLeft, tok.getType()); assertTrue(tok.getLine() == 1 && tok.g... | public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when parsing operat... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... |
@Test public void u_shift() throws Exception { String str = "a>>>=b>>>"; LexerStream ls = new LexerStream(new StringReader(str)); LexOperator lex = new LexOperator(new BaseTokenFactory(), ls); ls.read(); Token tok = lex.read(); assertEquals(TokenType.TripleRightShiftAssign, tok.getType()); assertTrue(tok.getLine() == 1... | public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when parsing operat... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... |
@Test public void tri() throws Exception { String str = "a?b:c$d"; LexerStream ls = new LexerStream(new StringReader(str)); LexOperator lex = new LexOperator(new BaseTokenFactory(), ls); ls.read(); Token tok = lex.read(); assertEquals(TokenType.Question, tok.getType()); assertTrue(tok.getLine() == 1 && tok.getEndLine()... | public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when parsing operat... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... |
@Test public void dot() throws Exception { String str = "a.b .3"; LexerStream ls = new LexerStream(new StringReader(str)); LexOperator lex = new LexOperator(new BaseTokenFactory(), ls); ls.read(); Token tok = lex.read(); assertEquals(TokenType.Dot, tok.getType()); assertTrue(tok.getLine() == 1 && tok.getEndLine() == 1)... | public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when parsing operat... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... |
@Test public void range() throws Exception { String str = "1..2...3,4"; LexerStream ls = new LexerStream(new StringReader(str)); LexOperator lex = new LexOperator(new BaseTokenFactory(), ls); ls.read(); Token tok = lex.read(); assertEquals(TokenType.DoubleDot, tok.getType()); assertTrue(tok.getLine() == 1 && tok.getEnd... | public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when parsing operat... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... |
@Test public void paren() throws Exception { String str = "(1)[2]{3}"; LexerStream ls = new LexerStream(new StringReader(str)); LexOperator lex = new LexOperator(new BaseTokenFactory(), ls); Token tok = lex.read(); assertEquals(TokenType.OpenParenthesis, tok.getType()); assertTrue(tok.getLine() == 1 && tok.getEndLine()... | public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when parsing operat... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... |
@Test public void hash() throws Exception { String str = "##"; LexerStream ls = new LexerStream(new StringReader(str)); LexOperator lex = new LexOperator(new BaseTokenFactory(), ls); Token tok = lex.read(); assertEquals(TokenType.Hash, tok.getType()); assertTrue(tok.getLine() == 1 && tok.getEndLine() == 1); assertEqual... | public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when parsing operat... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... |
@Test(expected = LexerException.class) public void empty() throws Exception { String str = ""; LexerStream ls = new LexerStream(new StringReader(str)); LexOperator lex = new LexOperator(new BaseTokenFactory(), ls); lex.read(); } | public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when parsing operat... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... | LexOperator { public Token read() throws IOException, LexerException { int index = in_stream.getPosition(); int line = in_stream.getLine(); int col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when ... |
@Test public void dotted() throws Exception { String str = "foo.bar"; LexerStream ls = new LexerStream(new StringReader(str)); LexIdentifier lex = new LexIdentifier(new BaseTokenFactory(), ls); Token tok = lex.read(); assertEquals(TokenType.Identifier, tok.getType()); assertEquals("foo", tok.getValue()); assertEquals(1... | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream when parsing identi... | LexIdentifier { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... | LexIdentifier { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... | LexIdentifier { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... | LexIdentifier { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... |
@Test public void simple() throws Exception { String str = "\"Here is a string\""; LexerStream ls = new LexerStream(new StringReader(str)); LexStringLiteral lex = new LexStringLiteral(new BaseTokenFactory(), ls); Token tok = lex.read(); assertEquals(TokenType.LiteralUtf8, tok.getType()); assertTrue(tok.getValue() insta... | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of inpu... | LexStringLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Une... | LexStringLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Une... | LexStringLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Une... | LexStringLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Une... |
@Test public void escaped() throws Exception { String str = "\"\\n\\\"\\tfoo\\\" \\x7c\""; LexerStream ls = new LexerStream(new StringReader(str)); LexStringLiteral lex = new LexStringLiteral(new BaseTokenFactory(), ls); Token tok = lex.read(); assertEquals(TokenType.LiteralUtf8, tok.getType()); assertTrue(tok.getValue... | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of inpu... | LexStringLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Une... | LexStringLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Une... | LexStringLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Une... | LexStringLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Une... |
@Test public void wysiwyg() throws Exception { String str = "r\"a\\b\\nc\""; LexerStream ls = new LexerStream(new StringReader(str)); LexStringLiteral lex = new LexStringLiteral(new BaseTokenFactory(), ls); Token tok = lex.read(); assertEquals(TokenType.LiteralUtf8, tok.getType()); assertTrue(tok.getValue() instanceof ... | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of inpu... | LexStringLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Une... | LexStringLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Une... | LexStringLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Une... | LexStringLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Une... |
@Test public void tick() throws Exception { String str = "`a\\b\\nc`"; LexerStream ls = new LexerStream(new StringReader(str)); LexStringLiteral lex = new LexStringLiteral(new BaseTokenFactory(), ls); Token tok = lex.read(); assertEquals(TokenType.LiteralUtf8, tok.getType()); assertTrue(tok.getValue() instanceof String... | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of inpu... | LexStringLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Une... | LexStringLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Une... | LexStringLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Une... | LexStringLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Une... |
@Test public void explicit_utf8() throws Exception { String str = "\"foo\"c"; LexerStream ls = new LexerStream(new StringReader(str)); LexStringLiteral lex = new LexStringLiteral(new BaseTokenFactory(), ls); Token tok = lex.read(); assertEquals(TokenType.LiteralUtf8, tok.getType()); assertTrue(tok.getValue() instanceof... | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of inpu... | LexStringLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Une... | LexStringLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Une... | LexStringLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Une... | LexStringLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Une... |
@Test public void explicit_utf16() throws Exception { String str = "\"foo\"w"; LexerStream ls = new LexerStream(new StringReader(str)); LexStringLiteral lex = new LexStringLiteral(new BaseTokenFactory(), ls); Token tok = lex.read(); assertEquals(TokenType.LiteralUtf16, tok.getType()); assertTrue(tok.getValue() instance... | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of inpu... | LexStringLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Une... | LexStringLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Une... | LexStringLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Une... | LexStringLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Une... |
@Test public void explicit_utf32() throws Exception { String str = "\"foo\"d"; LexerStream ls = new LexerStream(new StringReader(str)); LexStringLiteral lex = new LexStringLiteral(new BaseTokenFactory(), ls); Token tok = lex.read(); assertEquals(TokenType.LiteralUtf32, tok.getType()); assertTrue(tok.getValue() instance... | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of inpu... | LexStringLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Une... | LexStringLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Une... | LexStringLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Une... | LexStringLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Une... |
@Test(expected = LexerException.class) public void empty() throws Exception { String str = ""; LexerStream ls = new LexerStream(new StringReader(str)); LexStringLiteral lex = new LexStringLiteral(new BaseTokenFactory(), ls); lex.read(); } | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of inpu... | LexStringLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Une... | LexStringLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Une... | LexStringLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Une... | LexStringLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Une... |
@Test(expected = LexerException.class) public void unterminated() throws Exception { String str = "\"yadayada"; LexerStream ls = new LexerStream(new StringReader(str)); LexStringLiteral lex = new LexStringLiteral(new BaseTokenFactory(), ls); lex.read(); } | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of inpu... | LexStringLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Une... | LexStringLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Une... | LexStringLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Une... | LexStringLiteral { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); boolean is_literal = false; int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Une... |
@Test(expected = LexerException.class) public void empty() throws Exception { String str = ""; LexerStream ls = new LexerStream(new StringReader(str)); LexTokenString lex = new LexTokenString(new BaseTokenFactory(), ls, null); lex.read(); } | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of stream when parsing token string... | LexTokenString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of stream when par... | LexTokenString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of stream when par... | LexTokenString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of stream when par... | LexTokenString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of stream when par... |
@Test(expected = LexerException.class) public void reserved() throws Exception { String str = "__FOO__"; LexerStream ls = new LexerStream(new StringReader(str)); LexIdentifier lex = new LexIdentifier(new BaseTokenFactory(), ls); lex.read(); } | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream when parsing identi... | LexIdentifier { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... | LexIdentifier { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... | LexIdentifier { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... | LexIdentifier { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... |
@Test(expected = LexerException.class) public void not() throws Exception { String str = "q[]"; LexerStream ls = new LexerStream(new StringReader(str)); LexTokenString lex = new LexTokenString(new BaseTokenFactory(), ls, null); lex.read(); } | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of stream when parsing token string... | LexTokenString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of stream when par... | LexTokenString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of stream when par... | LexTokenString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of stream when par... | LexTokenString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of stream when par... |
@Test(expected = LexerException.class) public void also_not() throws Exception { String str = "\"q{}\""; LexerStream ls = new LexerStream(new StringReader(str)); LexTokenString lex = new LexTokenString(new BaseTokenFactory(), ls, null); lex.read(); } | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of stream when parsing token string... | LexTokenString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of stream when par... | LexTokenString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of stream when par... | LexTokenString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of stream when par... | LexTokenString { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of stream when par... |
@Test public void line() throws Exception { String str = "a LexerStream ls = new LexerStream(new StringReader(str)); LexComment lex = new LexComment(new BaseTokenFactory(), ls); ls.read(); Token tok = lex.read(); assertEquals(TokenType.LineComment, tok.getType()); assertEquals(" assertEquals(1, tok.getLine()); assertEq... | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream w... | LexComment { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of i... | LexComment { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of i... | LexComment { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of i... | LexComment { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of i... |
@Test public void block() throws Exception { String str = "a\ncde"; LexerStream ls = new LexerStream(new StringReader(str)); LexComment lex = new LexComment(new BaseTokenFactory(), ls); ls.read(); Token tok = lex.read(); assertEquals(TokenType.BlockComment, tok.getType()); assertEquals("", tok.getValue()); assertEquals... | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream w... | LexComment { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of i... | LexComment { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of i... | LexComment { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of i... | LexComment { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of i... |
@Test public void block_inline() throws Exception { String str = "a=c"; LexerStream ls = new LexerStream(new StringReader(str)); LexComment lex = new LexComment(new BaseTokenFactory(), ls); ls.read(); ls.read(); Token tok = lex.read(); assertEquals(TokenType.BlockComment, tok.getType()); assertEquals("", tok.getValue()... | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream w... | LexComment { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of i... | LexComment { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of i... | LexComment { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of i... | LexComment { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of i... |
@Test public void nest() throws Exception { String str = "a/+ /+b\n+/ /+c /+\nd\n +/ e+ LexerStream ls = new LexerStream(new StringReader(str)); LexComment lex = new LexComment(new BaseTokenFactory(), ls); ls.read(); Token tok = lex.read(); assertEquals(TokenType.BlockCommentNest, tok.getType()); assertEquals("/+ /+b\n... | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream w... | LexComment { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of i... | LexComment { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of i... | LexComment { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of i... | LexComment { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of i... |
@Test public void nest_inline() throws Exception { String str = "a = /+ "a = /+ \"+/\" +/ 1\";\n" + "a = /+ 3;"; LexerStream ls = new LexerStream(new StringReader(str)); LexComment lex = new LexComment(new BaseTokenFactory(), ls); ls.read(); ls.read(); ls.read(); ls.read(); Token tok = lex.read(); assertEquals(TokenTyp... | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream w... | LexComment { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of i... | LexComment { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of i... | LexComment { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of i... | LexComment { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of i... |
@Test public void escape() throws Exception { String str = "\\'" + "\\\"" + "\\?" + "\\\\" + "\\a" + "\\b" + "\\f" + "\\n" + "\\r" + "\\t" + "\\v" + "\\0" + ""; LexerStream ls = new LexerStream(new StringReader(str)); assertEquals('\'', (char)LexEscape.read(ls)); assertEquals('"', (char)LexEscape.read(ls)); assertEqual... | public static int read(final LexerStream in_stream) throws IOException, LexerException { int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when inside escape sequence"); } if (next != '\\') { throw new LexerException(in_strea... | LexEscape { public static int read(final LexerStream in_stream) throws IOException, LexerException { int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when inside escape sequence"); } if (next != '\\') { throw new LexerExcept... | LexEscape { public static int read(final LexerStream in_stream) throws IOException, LexerException { int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when inside escape sequence"); } if (next != '\\') { throw new LexerExcept... | LexEscape { public static int read(final LexerStream in_stream) throws IOException, LexerException { int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when inside escape sequence"); } if (next != '\\') { throw new LexerExcept... | LexEscape { public static int read(final LexerStream in_stream) throws IOException, LexerException { int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when inside escape sequence"); } if (next != '\\') { throw new LexerExcept... |
@Test public void oct() throws Exception { String str = "\\123 \\37 \\4"; LexerStream ls = new LexerStream(new StringReader(str)); assertEquals(83, LexEscape.read(ls)); ls.read(); assertEquals(31, LexEscape.read(ls)); ls.read(); assertEquals(4, LexEscape.read(ls)); } | public static int read(final LexerStream in_stream) throws IOException, LexerException { int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when inside escape sequence"); } if (next != '\\') { throw new LexerException(in_strea... | LexEscape { public static int read(final LexerStream in_stream) throws IOException, LexerException { int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when inside escape sequence"); } if (next != '\\') { throw new LexerExcept... | LexEscape { public static int read(final LexerStream in_stream) throws IOException, LexerException { int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when inside escape sequence"); } if (next != '\\') { throw new LexerExcept... | LexEscape { public static int read(final LexerStream in_stream) throws IOException, LexerException { int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when inside escape sequence"); } if (next != '\\') { throw new LexerExcept... | LexEscape { public static int read(final LexerStream in_stream) throws IOException, LexerException { int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when inside escape sequence"); } if (next != '\\') { throw new LexerExcept... |
@Test public void hex() throws Exception { String str = "\\xA1 \\uF0a5 \\UdeaDbEef"; LexerStream ls = new LexerStream(new StringReader(str)); assertEquals(0xa1, LexEscape.read(ls)); ls.read(); assertEquals(0xf0a5, LexEscape.read(ls)); ls.read(); assertEquals(0xdeadbeef, LexEscape.read(ls)); } | public static int read(final LexerStream in_stream) throws IOException, LexerException { int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when inside escape sequence"); } if (next != '\\') { throw new LexerException(in_strea... | LexEscape { public static int read(final LexerStream in_stream) throws IOException, LexerException { int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when inside escape sequence"); } if (next != '\\') { throw new LexerExcept... | LexEscape { public static int read(final LexerStream in_stream) throws IOException, LexerException { int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when inside escape sequence"); } if (next != '\\') { throw new LexerExcept... | LexEscape { public static int read(final LexerStream in_stream) throws IOException, LexerException { int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when inside escape sequence"); } if (next != '\\') { throw new LexerExcept... | LexEscape { public static int read(final LexerStream in_stream) throws IOException, LexerException { int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when inside escape sequence"); } if (next != '\\') { throw new LexerExcept... |
@Test(expected = LexerException.class) public void empty() throws Exception { String str = ""; LexerStream ls = new LexerStream(new StringReader(str)); LexIdentifier lex = new LexIdentifier(new BaseTokenFactory(), ls); lex.read(); } | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream when parsing identi... | LexIdentifier { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... | LexIdentifier { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... | LexIdentifier { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... | LexIdentifier { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... |
@Test public void html() throws Exception { String str = "\\> \\ÿ \\⊥"; LexerStream ls = new LexerStream(new StringReader(str)); assertEquals(62, LexEscape.read(ls)); ls.read(); assertEquals(255, LexEscape.read(ls)); ls.read(); assertEquals(8869, LexEscape.read(ls)); } | public static int read(final LexerStream in_stream) throws IOException, LexerException { int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when inside escape sequence"); } if (next != '\\') { throw new LexerException(in_strea... | LexEscape { public static int read(final LexerStream in_stream) throws IOException, LexerException { int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when inside escape sequence"); } if (next != '\\') { throw new LexerExcept... | LexEscape { public static int read(final LexerStream in_stream) throws IOException, LexerException { int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when inside escape sequence"); } if (next != '\\') { throw new LexerExcept... | LexEscape { public static int read(final LexerStream in_stream) throws IOException, LexerException { int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when inside escape sequence"); } if (next != '\\') { throw new LexerExcept... | LexEscape { public static int read(final LexerStream in_stream) throws IOException, LexerException { int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when inside escape sequence"); } if (next != '\\') { throw new LexerExcept... |
@Test(expected = LexerException.class) public void empty() throws Exception { String str = ""; LexerStream ls = new LexerStream(new StringReader(str)); LexEscape.read(ls); } | public static int read(final LexerStream in_stream) throws IOException, LexerException { int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when inside escape sequence"); } if (next != '\\') { throw new LexerException(in_strea... | LexEscape { public static int read(final LexerStream in_stream) throws IOException, LexerException { int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when inside escape sequence"); } if (next != '\\') { throw new LexerExcept... | LexEscape { public static int read(final LexerStream in_stream) throws IOException, LexerException { int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when inside escape sequence"); } if (next != '\\') { throw new LexerExcept... | LexEscape { public static int read(final LexerStream in_stream) throws IOException, LexerException { int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when inside escape sequence"); } if (next != '\\') { throw new LexerExcept... | LexEscape { public static int read(final LexerStream in_stream) throws IOException, LexerException { int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when inside escape sequence"); } if (next != '\\') { throw new LexerExcept... |
@Test(expected = LexerException.class) public void not() throws Exception { String str = "escape"; LexerStream ls = new LexerStream(new StringReader(str)); LexEscape.read(ls); } | public static int read(final LexerStream in_stream) throws IOException, LexerException { int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when inside escape sequence"); } if (next != '\\') { throw new LexerException(in_strea... | LexEscape { public static int read(final LexerStream in_stream) throws IOException, LexerException { int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when inside escape sequence"); } if (next != '\\') { throw new LexerExcept... | LexEscape { public static int read(final LexerStream in_stream) throws IOException, LexerException { int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when inside escape sequence"); } if (next != '\\') { throw new LexerExcept... | LexEscape { public static int read(final LexerStream in_stream) throws IOException, LexerException { int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when inside escape sequence"); } if (next != '\\') { throw new LexerExcept... | LexEscape { public static int read(final LexerStream in_stream) throws IOException, LexerException { int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when inside escape sequence"); } if (next != '\\') { throw new LexerExcept... |
@Test(expected = LexerException.class) public void unknown() throws Exception { String str = "\\z"; LexerStream ls = new LexerStream(new StringReader(str)); LexEscape.read(ls); } | public static int read(final LexerStream in_stream) throws IOException, LexerException { int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when inside escape sequence"); } if (next != '\\') { throw new LexerException(in_strea... | LexEscape { public static int read(final LexerStream in_stream) throws IOException, LexerException { int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when inside escape sequence"); } if (next != '\\') { throw new LexerExcept... | LexEscape { public static int read(final LexerStream in_stream) throws IOException, LexerException { int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when inside escape sequence"); } if (next != '\\') { throw new LexerExcept... | LexEscape { public static int read(final LexerStream in_stream) throws IOException, LexerException { int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when inside escape sequence"); } if (next != '\\') { throw new LexerExcept... | LexEscape { public static int read(final LexerStream in_stream) throws IOException, LexerException { int next = in_stream.peek(); if (next == -1) { throw new LexerException(in_stream.getLine(), in_stream.getCol(), "Unexpected end of input stream when inside escape sequence"); } if (next != '\\') { throw new LexerExcept... |
@Test(expected = LexerException.class) public void not() throws Exception { String str = "9d"; LexerStream ls = new LexerStream(new StringReader(str)); LexIdentifier lex = new LexIdentifier(new BaseTokenFactory(), ls); lex.read(); } | public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream when parsing identi... | LexIdentifier { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... | LexIdentifier { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... | LexIdentifier { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... | LexIdentifier { public Token read() throws IOException, LexerException { int start_index = in_stream.getPosition(); int start_line = in_stream.getLine(); int start_col = in_stream.getCol(); int next = in_stream.peek(); if (next == -1) { throw new LexerException(start_line, start_col, "Unexpected end of input stream whe... |
@Test public void lex() throws Exception { String code = "" + " "import std.stdio;\n" + "\n" + "void main() {\n" + " ulong lines = 0;\n" + " double sumLength=0;\n" + " foreach (line;stdin.byLine()){\n" + " ++lines;\n" + " sumLength += line.length;\n" + " }\n" + " writeln(\"Average line length: \",\n" + " lines ? sumLen... | public Token next() throws IOException { Token token; try { token = _next(); } catch (LexerException e) { token = factory.create(TokenType.Unknown, in_stream.getPosition(), in_stream.getLine(), in_stream.getCol()); in_stream.read(); } return token; } | Lexer { public Token next() throws IOException { Token token; try { token = _next(); } catch (LexerException e) { token = factory.create(TokenType.Unknown, in_stream.getPosition(), in_stream.getLine(), in_stream.getCol()); in_stream.read(); } return token; } } | Lexer { public Token next() throws IOException { Token token; try { token = _next(); } catch (LexerException e) { token = factory.create(TokenType.Unknown, in_stream.getPosition(), in_stream.getLine(), in_stream.getCol()); in_stream.read(); } return token; } Lexer(TokenFactory tokenFactory, Reader inStream); private L... | Lexer { public Token next() throws IOException { Token token; try { token = _next(); } catch (LexerException e) { token = factory.create(TokenType.Unknown, in_stream.getPosition(), in_stream.getLine(), in_stream.getCol()); in_stream.read(); } return token; } Lexer(TokenFactory tokenFactory, Reader inStream); private L... | Lexer { public Token next() throws IOException { Token token; try { token = _next(); } catch (LexerException e) { token = factory.create(TokenType.Unknown, in_stream.getPosition(), in_stream.getLine(), in_stream.getCol()); in_stream.read(); } return token; } Lexer(TokenFactory tokenFactory, Reader inStream); private L... |
@Test public void error() throws Exception { String code = "" + "\n" + "q\"/abc/def/\"\n" + ""; Lexer lexer = new Lexer(new BaseTokenFactory(), new StringReader(code)); assertEquals(TokenType.BlockComment, lexer.next().getType()); assertEquals(TokenType.Whitespace, lexer.next().getType()); assertEquals(TokenType.Unknow... | public Token next() throws IOException { Token token; try { token = _next(); } catch (LexerException e) { token = factory.create(TokenType.Unknown, in_stream.getPosition(), in_stream.getLine(), in_stream.getCol()); in_stream.read(); } return token; } | Lexer { public Token next() throws IOException { Token token; try { token = _next(); } catch (LexerException e) { token = factory.create(TokenType.Unknown, in_stream.getPosition(), in_stream.getLine(), in_stream.getCol()); in_stream.read(); } return token; } } | Lexer { public Token next() throws IOException { Token token; try { token = _next(); } catch (LexerException e) { token = factory.create(TokenType.Unknown, in_stream.getPosition(), in_stream.getLine(), in_stream.getCol()); in_stream.read(); } return token; } Lexer(TokenFactory tokenFactory, Reader inStream); private L... | Lexer { public Token next() throws IOException { Token token; try { token = _next(); } catch (LexerException e) { token = factory.create(TokenType.Unknown, in_stream.getPosition(), in_stream.getLine(), in_stream.getCol()); in_stream.read(); } return token; } Lexer(TokenFactory tokenFactory, Reader inStream); private L... | Lexer { public Token next() throws IOException { Token token; try { token = _next(); } catch (LexerException e) { token = factory.create(TokenType.Unknown, in_stream.getPosition(), in_stream.getLine(), in_stream.getCol()); in_stream.read(); } return token; } Lexer(TokenFactory tokenFactory, Reader inStream); private L... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.