Package org.drools.compiler

Examples of org.drools.compiler.DroolsParserException


                         DroolsParserExceptionFactory.TRAILING_SEMI_COLON_NOT_ALLOWED_MESSAGE,
                         line,
                         column,
                         formatParserLocation() );

        return new DroolsParserException( "ERR 104",
                                          message,
                                          line,
                                          column,
                                          offset,
                                          null );
View Full Code Here


     *            original exception
     * @return DroolsParserException filled.
     */
    public DroolsParserException createDroolsException( RecognitionException e ) {
        List<String> codeAndMessage = createErrorMessage( e );
        return new DroolsParserException( codeAndMessage.get( 1 ),
                                          codeAndMessage
                                                  .get( 0 ),
                                          e.line,
                                          e.charPositionInLine,
                                          e.index,
View Full Code Here

    public DroolsParserException createDroolsException( Exception e,
                                                        Token token ) {
        StringWriter sw = new StringWriter();
        e.printStackTrace( new PrintWriter(sw) );
        return new DroolsParserException( String.format(
                                                         DroolsParserExceptionFactory.UNEXPECTED_EXCEPTION,
                                                         token.getLine(),
                                                         token.getCharPositionInLine(),
                                                         getBetterToken( token ),
                                                         e.toString(),
View Full Code Here

                } else {
                    addPackage( pkg );
                }

            } catch ( Exception e ) {
                throw new DroolsParserException( e );
            }
        }
View Full Code Here

        builder.addPackageFromDrl( new StringReader( drl ) );
        Package pkg = builder.getPackage();

        if ( !pkg.isValid() ) {
            throw new DroolsParserException( pkg.getErrorSummary() );
        }
        return pkg;
    }
View Full Code Here

        parser.compilationUnit();
        assertTrue( parser.hasErrors() );

        assertEquals( 1,
                      parser.getErrors().size() );
        DroolsParserException err = (DroolsParserException) parser.getErrors().get( 0 );
        assertEquals( 6,
                      err.getLineNumber() );
    }
View Full Code Here

        return sb.toString();
    }

    List<FactMetaModel> toModel(String drl) throws DroolsParserException {
        if ( drl != null && drl.startsWith( "#advanced" ) ) {
            throw new DroolsParserException( "Using advanced editor" );
        }
        DrlParser parser = new DrlParser();
        PackageDescr pkg = parser.parse( drl );
        if ( parser.hasErrors() ) {
            throw new DroolsParserException( "The model drl " + drl + " is not valid" );
        }

        if ( pkg == null ) return new ArrayList<FactMetaModel>();
        List<TypeDeclarationDescr> types = pkg.getTypeDeclarations();
        List<FactMetaModel> list = new ArrayList<FactMetaModel>( types.size() );
View Full Code Here

    String message = String
        .format(
            DroolsParserExceptionFactory.TRAILING_SEMI_COLON_NOT_ALLOWED_MESSAGE,
            line, column, formatParserLocation());

    return new DroolsParserException("ERR 108", message, line, column,
        offset, null);
  }
View Full Code Here

   *            original exception
   * @return DroolsParserException filled.
   */
  public DroolsParserException createDroolsException(RecognitionException e) {
    List<String> codeAndMessage = createErrorMessage(e);
    return new DroolsParserException(codeAndMessage.get(1), codeAndMessage
        .get(0), e.line, e.charPositionInLine, e.index, e);
  }
View Full Code Here

        assertTrue( parser.hasErrors() );
//        for ( String message : this.parser.getErrorMessages() ) {
//            System.out.println( message );
//        }

        final DroolsParserException err = (DroolsParserException) parser.getErrors().get( 0 );
        assertEquals( 1,
                      parser.getErrors().size() );
        assertEquals( 6,
                      err.getLineNumber() );
    }
View Full Code Here

TOP

Related Classes of org.drools.compiler.DroolsParserException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.