lib/parsingUtils.js
// which is the requested orientation of the slice.
which is the requested orientation of the slice.
which is the requested orientation of the slice .
function parseOrientation(input) {
    const oc = "RequestedOrientation";
    let totalLength = input.length;
    var inputLC = input.toLowerCase();
    let idx = inputLC.indexOf(oc.toLowerCase());
    if (idx < 0){
        console.log("did not find corrent parameter in request.")
        console.assert(false);
        return undefined;
    }
    var states = {
        currentState: 0,
        nextState: 1,
        transitions: [
            {
                lookFor: new Set(['='])
            },
            {
                lookFor: new Set(['['])
            },
            {
                lookFor: new Set(['a','p','i','s','l','r'])
            },
            {
                lookFor: new Set([']'])
            }
        ]
    }
    stateInformation = {
        currentIndex: idx += oc.length,
        state: states,
        capturedInformation: undefined,
        finalState: 4,
        done: false
    }
    while (stateInformation != undefined && stateInformation.done === false){
        stateInformation = lookAhead(inputLC,stateInformation);
    }
    if (stateInformation != undefined){
        console.log(stateInformation.capturedInformation);
    }
}
function parseOrientation ( input ) { const oc = "RequestedOrientation" ; let totalLength = input . length ; var inputLC = input . toLowerCase ( ) ; let idx = inputLC . indexOf ( oc . toLowerCase ( ) ) ; if ( idx < 0 ) { console . log ( "did not find corrent parameter in request." ) console . assert ( false ) ; return undefined ; } var states = { currentState : 0 , nextState : 1 , transitions : [ { lookFor : new Set ( [ '=' ] ) } , { lookFor : new Set ( [ '[' ] ) } , { lookFor : new Set ( [ 'a' , 'p' , 'i' , 's' , 'l' , 'r' ] ) } , { lookFor : new Set ( [ ']' ] ) } ] } stateInformation = { currentIndex : idx += oc . length , state : states , capturedInformation : undefined , finalState : 4 , done : false } while ( stateInformation != undefined && stateInformation . done === false ) { stateInformation = lookAhead ( inputLC , stateInformation ) ; } if ( stateInformation != undefined ) { console . log ( stateInformation . capturedInformation ) ; } }
which is the requested orientation of the slice.
which is the requested orientation of the slice .
// Parsing states. look for =,then bracket, then desired character, then bracket to finish.