text:
package org.apache.axis2.clustering.tribes;

import org.apache.axis2.clustering.control.wka.MemberJoinedCommand;
import org.apache.axis2.clustering.control.wka.RpcMembershipRequestHandler;
import org.apache.axis2.clustering.management.DefaultGroupManagementAgent;
import org.apache.axis2.clustering.management.GroupManagementAgent;
import org.apache.catalina.tribes.Channel;
import org.apache.catalina.tribes.ChannelException;
import org.apache.catalina.tribes.Member;
import org.apache.catalina.tribes.MembershipListener;
import org.apache.catalina.tribes.RemoteProcessException;
import org.apache.catalina.tribes.group.RpcChannel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * Represents a member running in load balance mode
 */
public class ClusterManagementMode implements OperationMode {

    private static final Log log = LogFactory.getLog(ClusterManagementMode.class);

    private final byte[] clusterManagerDomain;

    /**
     * Map[key, value=Map[key, value]] = [domain, [subDomain, GroupManagementAgent]]
     */
    private final Map<String, Map<String, GroupManagementAgent>> groupManagementAgents;
    private final List<MembershipManager> membershipManagers = new ArrayList<MembershipManager>();
    private final MembershipManager primaryMembershipManager;

    private WkaBasedMembershipScheme wkaBasedMembershipScheme;

    public ClusterManagementMode(byte[] clusterManagerDomain,
                            Map<String, Map<String, GroupManagementAgent>> groupManagementAgents,
                            MembershipManager primaryMembershipManager) {
        this.clusterManagerDomain = clusterManagerDomain;
        this.groupManagementAgents = groupManagementAgents;
        this.primaryMembershipManager = primaryMembershipManager;
    }

    public void addInterceptors(Channel channel) {
        ClusterManagementInterceptor interceptor =
                new ClusterManagementInterceptor(clusterManagerDomain);
        interceptor.setOptionFlag(TribesConstants.MEMBERSHIP_MSG_OPTION);
        channel.addInterceptor(interceptor);
        if (log.isDebugEnabled()) {
            log.debug("Added ClusterManagementInterceptor");
        }
    }

    public void init(Channel channel) {
        // Have multiple RPC channels with multiple RPC request handlers for each domain
        // This is needed only when this member is running as a load balancer
        for (String domain : groupManagementAgents.keySet()) {
            Map<String, GroupManagementAgent> groupMgtAgents = groupManagementAgents.get(domain);
            for (GroupManagementAgent groupMgtAgent : groupMgtAgents.values()) {
                addGroupManagementAgent(channel, domain, groupMgtAgent);
            }
        }
    }

    public void setWkaBasedMembershipScheme(WkaBasedMembershipScheme wkaBasedMembershipScheme) {
        this.wkaBasedMembershipScheme = wkaBasedMembershipScheme;
    }

    /**
     * Add a new GroupManagementAgent
     * @param channel The channel related to this member
     * @param domain  Domain of the GroupManagementAgent
     * @param groupMgtAgent the GroupManagementAgent to be added
     */
    public void addGroupManagementAgent(Channel channel, String domain, GroupManagementAgent groupMgtAgent) {
        final MembershipManager membershipManager = new MembershipManager();
        membershipManager.setDomain(domain.getBytes());
        membershipManager.setGroupManagementAgent(groupMgtAgent);
        if(groupMgtAgent instanceof DefaultGroupManagementAgent) {
            ((DefaultGroupManagementAgent) groupMgtAgent).setMembershipManager(membershipManager);
        }
        MembershipListener membershipListener = new MembershipListener() {
            public void memberAdded(Member member) {
                if (log.isDebugEnabled()) {
                    log.debug("Member " + TribesUtil.getName(member) + " joined cluster");
                }
                membershipManager.memberAdded(member);
            }

            public void memberDisappeared(Member member) {
                if (log.isDebugEnabled()) {
                    log.debug("Member " + TribesUtil.getName(member) + " left cluster");
                }
                membershipManager.memberDisappeared(member);
            }
        };
        if (wkaBasedMembershipScheme != null) {
            RpcChannel rpcMembershipChannel =
                    new RpcChannel(TribesUtil.getRpcMembershipChannelId(membershipManager.getDomain()),
                                   channel,
                                   new RpcMembershipRequestHandler(membershipManager, wkaBasedMembershipScheme));
            membershipManager.setRpcMembershipChannel(rpcMembershipChannel);
        }
        channel.addMembershipListener(membershipListener);
        membershipManagers.add(membershipManager);
    }

    public List<MembershipManager> getMembershipManagers() {
        return membershipManagers;
    }

    public void notifyMemberJoin(final Member member) {
        if (TribesUtil.isInDomain(member, clusterManagerDomain)) {  // A peer load balancer has joined

            // Notify all members in the LB group
            primaryMembershipManager.sendMemberJoinedToAll(member);

            // Send the MEMBER_LISTS of all the groups to the the new LB member
            for (MembershipManager manager : membershipManagers) {
                manager.sendMemberList(member);
            }
        } else { // An application member has joined.

            // Need to notify all members in the group of the new app member
            Thread th = new Thread() {
                public void run() {
                    for (MembershipManager manager : membershipManagers) {
                        if (TribesUtil.isInDomain(member, manager.getDomain())) {

                            // Send MEMBER_JOINED to the group of the new member
                            manager.sendMemberJoinedToAll(member);

                            // Send MEMBER_JOINED to the load balancer group
                            sendMemberJoinedToLoadBalancerGroup(manager.getRpcMembershipChannel(),
                                                                member);
                        }
                    }
                }

                /**
                 * Send MEMBER_JOINED to the load balancer group
                 * @param rpcChannel The RpcChannel corresponding to the member's group
                 * @param member  The member who joined
                 */
                private void sendMemberJoinedToLoadBalancerGroup(RpcChannel rpcChannel,
                                                                 Member member) {
                    MemberJoinedCommand cmd = new MemberJoinedCommand();
                    cmd.setMember(member);
                    try {
                        rpcChannel.send(primaryMembershipManager.getMembers(),
                                        cmd,
                                        RpcChannel.ALL_REPLY,
                                        Channel.SEND_OPTIONS_ASYNCHRONOUS,
                                        10000);
                    } catch (ChannelException e) {
                        String errMsg = "Could not send MEMBER_JOINED[" +
                                        TribesUtil.getName(member) +
                                        "] to all load balancer members ";
                        log.error(errMsg, e);
                        throw new RemoteProcessException(errMsg, e);
                    }
                }
            };
            th.start();
        }
    }
}


text:
"""
tap2rpm
"""
import sys

try:
    import _preamble
except ImportError:
    sys.exc_clear()

from twisted.scripts import tap2rpm
tap2rpm.run()

redpajama_set_name: RedPajamaGithub


text:
PRAGMA_DISABLE_DEPRECATION_WARNINGS

#include "CoreShell.h"
#include "ManageObject.h"
#include "TypeConvertor.h"
#include "Runtime/AIModule/Classes/AISubsystem.h"
#include "ManageAISubsystem.generated.h"

// Source file C:\Program Files\Epic Games\UE_4.22\Engine\Source\Runtime\AIModule\Classes\AISubsystem.h:15

UCLASS()
class UNREALDOTNETRUNTIME_API UManageAISubsystem : public UAISubsystem, public IManageObject
{
	GENERATED_BODY()

public:
	bool bIsManageAttach = false;
	bool AddWrapperIfNotAttach() override;
	void SetManageType(const FDotnetTypeName& ManageType) override;

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "C#")
	FDotnetTypeName ManageClassName;

	virtual void BeginDestroy() override;
	virtual void FinishDestroy() override;
	virtual void MarkAsEditorOnlySubobject() override;
	virtual void PostCDOContruct() override;
	virtual void PostEditImport() override;
	virtual void PostInitProperties() override;
	virtual void PostLoad() override;
	virtual void PostNetReceive() override;
	virtual void PostRepNotifies() override;
	virtual void PostSaveRoot(bool bCleanupIsRequired) override;
	virtual void PreDestroyFromReplication() override;
	virtual void PreNetReceive() override;
	virtual void ShutdownAfterError() override;
	virtual void CreateCluster() override;
	virtual void OnClusterMarkedAsPendingKill() override;

	void _Supper__BeginDestroy();
	void _Supper__FinishDestroy();
	void _Supper__MarkAsEditorOnlySubobject();
	void _Supper__PostCDOContruct();
	void _Supper__PostEditImport();
	void _Supper__PostInitProperties();
	void _Supper__PostLoad();
	void _Supper__PostNetReceive();
	void _Supper__PostRepNotifies();
	void _Supper__PostSaveRoot(bool bCleanupIsRequired);
	void _Supper__PreDestroyFromReplication();
	void _Supper__PreNetReceive();
	void _Supper__ShutdownAfterError();
	void _Supper__CreateCluster();
	void _Supper__OnClusterMarkedAsPendingKill();
};

PRAGMA_ENABLE_DEPRECATION_WARNINGS


text:
export default function($scope, $log, $q, $wpApiPosts, CONFIG) {
    'ngInject';

    var isLoadingMore = false,
        vm = this;
    vm.posts = [];
    vm.loadMore = ionic.throttle(doLoadMore, 1000);
    vm.refresh = refresh;

    $scope.$on('$ionicView.loaded', init);

    function init() {
        vm.page = 1;
        vm.isPaginationOver = false;
    }

    function refresh() {
        init();
        vm.posts = null;
        vm.loadMore().finally(() => $scope.$broadcast('scroll.refreshComplete'));
    }

    function doLoadMore() {
        // prevent multiple call when the server takes some time to answer
        if (isLoadingMore || vm.isPaginationOver) {
            return $q.when(null);
        }
        isLoadingMore = true;
        return getPosts(vm.page).then((response) => {
            vm.page++;
            vm.posts = (vm.posts) ? vm.posts.concat(response.data) : response.data;
            vm.isPaginationOver = response.isPaginationOver;
            $scope.$broadcast('scroll.infiniteScrollComplete');
        }).finally(() => isLoadingMore = false);
    }

    function getPosts(page) {
        return $wpApiPosts.$getList({
            page: page,
            "filter[posts_per_page]": CONFIG.posts.posts_per_page,
            "filter[orderby]": CONFIG.posts.orderby,
            "filter[order]": CONFIG.posts.order,
            "filter[post_status]": CONFIG.posts.post_status
        }).then((response) => {
            // Check if we reached the last page
            response.isPaginationOver = (response.data.length == 0 || response.data.length < CONFIG.posts.posts_per_page);
            return response;
        });
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
    public class DeserializeObject
    {
        #region Types
        public class Account
        {
            public string Email { get; set; }
            public bool Active { get; set; }
            public DateTime CreatedDate { get; set; }
            public IList<string> Roles { get; set; }
        }
        #endregion

        public void Example()
        {
            #region Usage
            string json = @"{
              'Email': 'james@example.com',
              'Active': true,
              'CreatedDate': '2013-01-20T00:00:00Z',
              'Roles': [
                'User',
                'Admin'
              ]
            }";

            Account account = JsonConvert.DeserializeObject<Account>(json);

            Console.WriteLine(account.Email);
            // james@example.com
            #endregion
        }
    }
}


text:
<?php

class Login extends CI_Controller{

	public function __construct(){

		parent::__construct();
		$this->load->model('Contents');
		$this->load->library(array('form_validation','session'));
		$this->load->database();
		$this->load->helper('url');
	}

	public function index(){

	$session = $this->session->userdata('isLogin');

		if($session == FALSE){

		redirect('login/login_form');

		}else{

		redirect('home');

		}
	}

	public function login_form(){

		$this->form_validation->set_rules('username', 'Username', 'required|trim');
		$this->form_validation->set_rules('password', 'Password', 'required|md5');
		$this->form_validation->set_error_delimiters('', '');

	if($this->form_validation->run()==FALSE){

		$this->load->view('login');

	}
	else{

		$username = $this->input->post('username');
		$password = $this->input->post('password');
		$level = $this->input->post('level');
		$cek = $this->Contents->takeUser($username, $password, $level);

		if($cek <> 0)
		{
			$this->session->set_userdata('isLogin', TRUE);
			$this->session->set_userdata('username',$username);
			$this->session->set_userdata('user_id',$user_id);
			$this->session->set_userdata('level',$level);
			redirect('home');
		}else
		{
			echo " ";
			}
		}
	}

	public function logout()
	{
		$this->session->sess_destroy();
		redirect('login/login_form');
		}
	}
?>


text:
<?php

use yii\db\Schema;
use yii\db\Migration;

class m151228_224542_add_fulltext_index extends Migration
{
    public function up()
    {

    }

    public function down()
    {
        echo "m151228_224542_add_fulltext_index cannot be reverted.\n";

        return false;
    }

    /*
    // Use safeUp/safeDown to run migration code within a transaction
    public function safeUp()
    {
    }

    public function safeDown()
    {
    }
    */
}


text:
class FormMetaClass(type):
    """Metaclass for forms.

    This metaclass calls .build() on form when their class is
    defined.
    """

    def __init__(self, name, bases, dict):
        type.__init__(self, name, bases, dict)
        # Do not call for Form itself, only subclasses.
        if object not in bases:
            self.build()

class Form(object):
    """Form Object.

    A form consists of controls. Each control maps a set of values
    between the web domain and the database domain. Values in the web
    domain are strings, values in the database domain are values
    understood by the DBAPI.
    """

    __metaclass__ = FormMetaClass

    inputs = []
    outputs = []

    def __init__(self):
        """Constructor."""
        self.m_inputs = []
        for cls in self.inputs:
            obj = cls(self)
            self.m_inputs.append(obj)
        self.m_outputs = []
        for cls in self.outputs:
            obj = cls(self)
            self.m_outputs.append(obj)

    @classmethod
    def build(cls):
        """Build the form. This performs a few checks on the form
        definition and plugs in some default values."""
        from draco2.form.check import CheckVisitor
        from draco2.form.build import BuildVisitor
        checker = CheckVisitor()
        checker.visit(cls)
        builder = BuildVisitor()
        builder.visit(cls)

    def parse(self, args):
        """Parse form arguments.

        The `args' parameter must be a mapping of strings to lists of
        strings and FileUpload classes.
        """
        result = {}
        for co in self.m_inputs:
            result.update(co.parse(args))
        return result

    def unparse(self, object, keep_empty_values=True):
        """Unparse form arguments.

        The `object' parameter must be a mapping of string names
        to DB-API types.
        """
        result = {}
        for co in self.m_outputs:
            result.update(co.unparse(object))
        if not keep_empty_values:
            keys = [ key for key in result if result[key] == '' ]
            for key in keys:
                del result[key]
        return result


text:
package org.pentaho.di.trans.step;

import java.util.List;

import org.pentaho.di.core.Const;
import org.pentaho.di.core.changed.ChangedFlag;
import org.pentaho.di.core.row.RowMeta;
import org.pentaho.di.core.row.RowMetaInterface;
import org.pentaho.di.core.row.ValueMeta;
import org.pentaho.di.core.row.ValueMetaInterface;
import org.pentaho.di.core.variables.VariableSpace;
import org.pentaho.di.core.xml.XMLHandler;
import org.pentaho.di.core.xml.XMLInterface;
import org.w3c.dom.Node;

/**
 * This class contains the metadata to handle proper error handling on a step level.
 *
 * @author Matt
 *
 */
public class StepErrorMeta extends ChangedFlag implements XMLInterface, Cloneable {
  public static final String XML_TAG = "error";

  /** The source step that can send the error rows */
  private StepMeta sourceStep;

  /** The target step to send the error rows to */
  private StepMeta targetStep;

  /** Is the error handling enabled? */
  private boolean enabled;

  /** the name of the field value to contain the number of errors (null or empty means it's not needed) */
  private String nrErrorsValuename;

  /** the name of the field value to contain the error description(s) (null or empty means it's not needed) */
  private String errorDescriptionsValuename;

  /**
   * the name of the field value to contain the fields for which the error(s) occured (null or empty means it's not
   * needed)
   */
  private String errorFieldsValuename;

  /** the name of the field value to contain the error code(s) (null or empty means it's not needed) */
  private String errorCodesValuename;

  /** The maximum number of errors allowed before we stop processing with a hard error */
  private String maxErrors = "";

  /** The maximum percent of errors allowed before we stop processing with a hard error */
  private String maxPercentErrors = "";

  /** The minimum number of rows to read before the percentage evaluation takes place */
  private String minPercentRows = "";

  private VariableSpace variables;

  /**
   * Create a new step error handling metadata object
   *
   * @param sourceStep
   *          The source step that can send the error rows
   */
  public StepErrorMeta( VariableSpace space, StepMeta sourceStep ) {
    this.sourceStep = sourceStep;
    this.enabled = false;
    this.variables = space;
  }

  /**
   * Create a new step error handling metadata object
   *
   * @param sourceStep
   *          The source step that can send the error rows
   * @param targetStep
   *          The target step to send the error rows to
   */
  public StepErrorMeta( VariableSpace space, StepMeta sourceStep, StepMeta targetStep ) {
    this.sourceStep = sourceStep;
    this.targetStep = targetStep;
    this.enabled = false;
    this.variables = space;
  }

  /**
   * Create a new step error handling metadata object
   *
   * @param sourceStep
   *          The source step that can send the error rows
   * @param targetStep
   *          The target step to send the error rows to
   * @param nrErrorsValuename
   *          the name of the field value to contain the number of errors (null or empty means it's not needed)
   * @param errorDescriptionsValuename
   *          the name of the field value to contain the error description(s) (null or empty means it's not needed)
   * @param errorFieldsValuename
   *          the name of the field value to contain the fields for which the error(s) occured (null or empty means it's
   *          not needed)
   * @param errorCodesValuename
   *          the name of the field value to contain the error code(s) (null or empty means it's not needed)
   */
  public StepErrorMeta( VariableSpace space, StepMeta sourceStep, StepMeta targetStep, String nrErrorsValuename,
    String errorDescriptionsValuename, String errorFieldsValuename, String errorCodesValuename ) {
    this.sourceStep = sourceStep;
    this.targetStep = targetStep;
    this.enabled = false;
    this.nrErrorsValuename = nrErrorsValuename;
    this.errorDescriptionsValuename = errorDescriptionsValuename;
    this.errorFieldsValuename = errorFieldsValuename;
    this.errorCodesValuename = errorCodesValuename;
    this.variables = space;
  }

  public StepErrorMeta clone() {
    try {
      return (StepErrorMeta) super.clone();
    } catch ( CloneNotSupportedException e ) {
      return null;
    }
  }

  public String getXML() {
    StringBuffer xml = new StringBuffer( 300 );

    xml.append( "      " ).append( XMLHandler.openTag( XML_TAG ) ).append( Const.CR );
    xml.append( "        " ).append(
      XMLHandler.addTagValue( "source_step", sourceStep != null ? sourceStep.getName() : "" ) );
    xml.append( "        " ).append(
      XMLHandler.addTagValue( "target_step", targetStep != null ? targetStep.getName() : "" ) );
    xml.append( "        " ).append( XMLHandler.addTagValue( "is_enabled", enabled ) );
    xml.append( "        " ).append( XMLHandler.addTagValue( "nr_valuename", nrErrorsValuename ) );
    xml
      .append( "        " ).append(
        XMLHandler.addTagValue( "descriptions_valuename", errorDescriptionsValuename ) );
    xml.append( "        " ).append( XMLHandler.addTagValue( "fields_valuename", errorFieldsValuename ) );
    xml.append( "        " ).append( XMLHandler.addTagValue( "codes_valuename", errorCodesValuename ) );
    xml.append( "        " ).append( XMLHandler.addTagValue( "max_errors", maxErrors ) );
    xml.append( "        " ).append( XMLHandler.addTagValue( "max_pct_errors", maxPercentErrors ) );
    xml.append( "        " ).append( XMLHandler.addTagValue( "min_pct_rows", minPercentRows ) );
    xml.append( "      " ).append( XMLHandler.closeTag( XML_TAG ) ).append( Const.CR );

    return xml.toString();
  }

  public StepErrorMeta( VariableSpace variables, Node node, List<StepMeta> steps ) {
    this.variables = variables;

    sourceStep = StepMeta.findStep( steps, XMLHandler.getTagValue( node, "source_step" ) );
    targetStep = StepMeta.findStep( steps, XMLHandler.getTagValue( node, "target_step" ) );
    enabled = "Y".equals( XMLHandler.getTagValue( node, "is_enabled" ) );
    nrErrorsValuename = XMLHandler.getTagValue( node, "nr_valuename" );
    errorDescriptionsValuename = XMLHandler.getTagValue( node, "descriptions_valuename" );
    errorFieldsValuename = XMLHandler.getTagValue( node, "fields_valuename" );
    errorCodesValuename = XMLHandler.getTagValue( node, "codes_valuename" );
    maxErrors = XMLHandler.getTagValue( node, "max_errors" );
    maxPercentErrors = XMLHandler.getTagValue( node, "max_pct_errors" );
    minPercentRows = XMLHandler.getTagValue( node, "min_pct_rows" );
  }

  /**
   * @return the error codes valuename
   */
  public String getErrorCodesValuename() {
    return errorCodesValuename;
  }

  /**
   * @param errorCodesValuename
   *          the error codes valuename to set
   */
  public void setErrorCodesValuename( String errorCodesValuename ) {
    this.errorCodesValuename = errorCodesValuename;
  }

  /**
   * @return the error descriptions valuename
   */
  public String getErrorDescriptionsValuename() {
    return errorDescriptionsValuename;
  }

  /**
   * @param errorDescriptionsValuename
   *          the error descriptions valuename to set
   */
  public void setErrorDescriptionsValuename( String errorDescriptionsValuename ) {
    this.errorDescriptionsValuename = errorDescriptionsValuename;
  }

  /**
   * @return the error fields valuename
   */
  public String getErrorFieldsValuename() {
    return errorFieldsValuename;
  }

  /**
   * @param errorFieldsValuename
   *          the error fields valuename to set
   */
  public void setErrorFieldsValuename( String errorFieldsValuename ) {
    this.errorFieldsValuename = errorFieldsValuename;
  }

  /**
   * @return the nr errors valuename
   */
  public String getNrErrorsValuename() {
    return nrErrorsValuename;
  }

  /**
   * @param nrErrorsValuename
   *          the nr errors valuename to set
   */
  public void setNrErrorsValuename( String nrErrorsValuename ) {
    this.nrErrorsValuename = nrErrorsValuename;
  }

  /**
   * @return the target step
   */
  public StepMeta getTargetStep() {
    return targetStep;
  }

  /**
   * @param targetStep
   *          the target step to set
   */
  public void setTargetStep( StepMeta targetStep ) {
    this.targetStep = targetStep;
  }

  /**
   * @return The source step can send the error rows
   */
  public StepMeta getSourceStep() {
    return sourceStep;
  }

  /**
   * @param sourceStep
   *          The source step can send the error rows
   */
  public void setSourceStep( StepMeta sourceStep ) {
    this.sourceStep = sourceStep;
  }

  /**
   * @return the enabled flag: Is the error handling enabled?
   */
  public boolean isEnabled() {
    return enabled;
  }

  /**
   * @param enabled
   *          the enabled flag to set: Is the error handling enabled?
   */
  public void setEnabled( boolean enabled ) {
    this.enabled = enabled;
  }

  public RowMetaInterface getErrorFields() {
    return getErrorRowMeta( 0L, null, null, null );
  }

  public RowMetaInterface getErrorRowMeta( long nrErrors, String errorDescriptions, String fieldNames,
    String errorCodes ) {
    RowMetaInterface row = new RowMeta();

    String nrErr = variables.environmentSubstitute( getNrErrorsValuename() );
    if ( !Const.isEmpty( nrErr ) ) {
      ValueMetaInterface v = new ValueMeta( nrErr, ValueMetaInterface.TYPE_INTEGER );
      v.setLength( 3 );
      row.addValueMeta( v );
    }
    String errDesc = variables.environmentSubstitute( getErrorDescriptionsValuename() );
    if ( !Const.isEmpty( errDesc ) ) {
      ValueMetaInterface v = new ValueMeta( errDesc, ValueMetaInterface.TYPE_STRING );
      row.addValueMeta( v );
    }
    String errFields = variables.environmentSubstitute( getErrorFieldsValuename() );
    if ( !Const.isEmpty( errFields ) ) {
      ValueMetaInterface v = new ValueMeta( errFields, ValueMetaInterface.TYPE_STRING );
      row.addValueMeta( v );
    }
    String errCodes = variables.environmentSubstitute( getErrorCodesValuename() );
    if ( !Const.isEmpty( errCodes ) ) {
      ValueMetaInterface v = new ValueMeta( errCodes, ValueMetaInterface.TYPE_STRING );
      row.addValueMeta( v );
    }

    return row;
  }

  public void addErrorRowData( Object[] row, int startIndex, long nrErrors, String errorDescriptions,
    String fieldNames, String errorCodes ) {
    int index = startIndex;

    String nrErr = variables.environmentSubstitute( getNrErrorsValuename() );
    if ( !Const.isEmpty( nrErr ) ) {
      row[index] = new Long( nrErrors );
      index++;
    }
    String errDesc = variables.environmentSubstitute( getErrorDescriptionsValuename() );
    if ( !Const.isEmpty( errDesc ) ) {
      row[index] = errorDescriptions;
      index++;
    }
    String errFields = variables.environmentSubstitute( getErrorFieldsValuename() );
    if ( !Const.isEmpty( errFields ) ) {
      row[index] = fieldNames;
      index++;
    }
    String errCodes = variables.environmentSubstitute( getErrorCodesValuename() );
    if ( !Const.isEmpty( errCodes ) ) {
      row[index] = errorCodes;
      index++;
    }
  }

  /**
   * @return the maxErrors
   */
  public String getMaxErrors() {
    return maxErrors;
  }

  /**
   * @param maxErrors
   *          the maxErrors to set
   */
  public void setMaxErrors( String maxErrors ) {
    this.maxErrors = maxErrors;
  }

  /**
   * @return the maxPercentErrors
   */
  public String getMaxPercentErrors() {
    return maxPercentErrors;
  }

  /**
   * @param maxPercentErrors
   *          the maxPercentErrors to set
   */
  public void setMaxPercentErrors( String maxPercentErrors ) {
    this.maxPercentErrors = maxPercentErrors;
  }

  /**
   * @return the minRowsForPercent
   */
  public String getMinPercentRows() {
    return minPercentRows;
  }

  /**
   * @param minRowsForPercent
   *          the minRowsForPercent to set
   */
  public void setMinPercentRows( String minRowsForPercent ) {
    this.minPercentRows = minRowsForPercent;
  }
}


text:
namespace Microsoft.Azure.Management.WebSites.Models
{
    using System;
    using System.Linq;
    using System.Collections.Generic;
    using Newtonsoft.Json;
    using Microsoft.Rest;
    using Microsoft.Rest.Serialization;
    using Microsoft.Rest.Azure;

    /// <summary>
    /// VNETInfo contract. This contract is public and is a stripped down
    /// version of VNETInfoInternal
    /// </summary>
    [JsonTransformation]
    public partial class VnetInfo : Resource
    {
        /// <summary>
        /// Initializes a new instance of the VnetInfo class.
        /// </summary>
        public VnetInfo() { }

        /// <summary>
        /// Initializes a new instance of the VnetInfo class.
        /// </summary>
        public VnetInfo(string name, string location, string id = default(string), string kind = default(string), string type = default(string), IDictionary<string, string> tags = default(IDictionary<string, string>), string vnetResourceId = default(string), string certThumbprint = default(string), string certBlob = default(string), IList<VnetRoute> routes = default(IList<VnetRoute>), bool? resyncRequired = default(bool?), string dnsServers = default(string))
            : base(name, location, id, kind, type, tags)
        {
            VnetResourceId = vnetResourceId;
            CertThumbprint = certThumbprint;
            CertBlob = certBlob;
            Routes = routes;
            ResyncRequired = resyncRequired;
            DnsServers = dnsServers;
        }

        /// <summary>
        /// The vnet resource id
        /// </summary>
        [JsonProperty(PropertyName = "properties.vnetResourceId")]
        public string VnetResourceId { get; set; }

        /// <summary>
        /// The client certificate thumbprint
        /// </summary>
        [JsonProperty(PropertyName = "properties.certThumbprint")]
        public string CertThumbprint { get; set; }

        /// <summary>
        /// A certificate file (.cer) blob containing the public key of the
        /// private key used to authenticate a
        /// Point-To-Site VPN connection.
        /// </summary>
        [JsonProperty(PropertyName = "properties.certBlob")]
        public string CertBlob { get; set; }

        /// <summary>
        /// The routes that this virtual network connection uses.
        /// </summary>
        [JsonProperty(PropertyName = "properties.routes")]
        public IList<VnetRoute> Routes { get; set; }

        /// <summary>
        /// Flag to determine if a resync is required
        /// </summary>
        [JsonProperty(PropertyName = "properties.resyncRequired")]
        public bool? ResyncRequired { get; set; }

        /// <summary>
        /// Dns servers to be used by this VNET. This should be a
        /// comma-separated list of IP addresses.
        /// </summary>
        [JsonProperty(PropertyName = "properties.dnsServers")]
        public string DnsServers { get; set; }

        /// <summary>
        /// Validate the object. Throws ValidationException if validation fails.
        /// </summary>
        public override void Validate()
        {
            base.Validate();
            if (this.Routes != null)
            {
                foreach (var element in this.Routes)
                {
                    if (element != null)
                    {
                        element.Validate();
                    }
                }
            }
        }
    }
}


text:
package interfaces

// Playlist is an interface of methods that must be implemented by playlists.
type Playlist interface {
	GetID() string
	GetTitle() string
	GetSubmitter() string
	GetService() string
}


text:
//******************************************************************************************************************************************************************************************//
// Copyright (c) 2021 abergs (https://github.com/abergs/fido2-net-lib)                                                                                //
//                                                                                //
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),                                       //
// to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,   //
// and to permit persons to whom the Software is furnished to do so, subject to the following conditions:                                                                                //
//                                                                                //
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.                                                           //
//                                                                                //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,                                      //
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,                            //
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               //
//                                                                                //
//******************************************************************************************************************************************************************************************//
using Newtonsoft.Json;

namespace Neos.IdentityServer.MultiFactor.WebAuthN
{
    /// <summary>
    /// Contains the current BiometricStatusReport of one of the authenticator's biometric component.
    /// </summary>
    /// <remarks>
    /// <see href="https://fidoalliance.org/specs/fido-v2.0-rd-20180702/fido-metadata-service-v2.0-rd-20180702.html#biometricstatusreport-dictionary"/>
    /// </remarks>
    public class BiometricStatusReport
    {
        /// <summary>
        /// Gets or sets the level of the biometric certification of this biometric component of the authenticator.
        /// </summary>
        [JsonProperty("certLevel", Required = Required.Always)]
        public ushort CertLevel { get; set; }
        /// <summary>
        /// Gets or sets a single USER_VERIFY constant indicating the modality of the biometric component.
        /// </summary>
        /// <remarks>
        /// This is not a bit flag combination.
        /// This value MUST be non-zero and this value MUST correspond to one or more entries in field userVerificationDetails in the related Metadata Statement.
        /// </remarks>
        [JsonProperty("modality", Required = Required.Always)]
        public ulong Modality { get; set; }
        /// <summary>
        /// Gets or sets a ISO-8601 formatted date since when the certLevel achieved, if applicable.
        /// <para>If no date is given, the status is assumed to be effective while present.</para>
        /// </summary>
        [JsonProperty("effectiveDate")]
        public string EffectiveDate { get; set; }
        /// <summary>
        /// Gets or sets the externally visible aspects of the Biometric Certification evaluation.
        /// </summary>
        [JsonProperty("certificationDescriptor")]
        public string CertificationDescriptor { get; set; }
        /// <summary>
        /// Gets or sets the unique identifier for the issued Biometric Certification.
        /// </summary>
        [JsonProperty("certificateNumber")]
        public string CertificateNumber { get; set; }
        /// <summary>
        /// Gets or sets the  version of the Biometric Certification Policy the implementation is Certified to.
        /// </summary>
        /// <remarks>
        /// For example: "1.0.0".
        /// </remarks>
        [JsonProperty("certificationPolicyVersion")]
        public string CertificationPolicyVersion { get; set; }
        /// <summary>
        /// Gets or sets the version of the Biometric Requirements the implementation is certified to.
        /// </summary>
        /// <remarks>
        /// For example: "1.0.0".
        /// </remarks>
        [JsonProperty("certificationRequirementsVersion")]
        public string CertificationRequirementsVersion { get; set; }
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>twitter4j.media (twitter4j-media-support 3.0.4 API)</title>
<meta name="date" content="2013-10-08">
<link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">

twitter4j.media

Interfaces

ImageUpload

Classes

ImageUploadFactory

Version

Enums

MediaProvider


text:
var Component = new Brick.Component();
Component.requires = {
    mod: [
        {name: '{C#MODNAME}', files: ['lib.js']}
    ]
};
Component.entryPoint = function(NS){
    var Y = Brick.YUI,
        COMPONENT = this,
        SYS = Brick.mod.sys;

    NS.TypeSelectWidget = Y.Base.create('TypeSelectWidget', SYS.AppWidget, [], {
        buildTData: function(){
            return {
                parentTaskId: this.get('parentTaskId')
            };
        },
        onInitAppWidget: function(err, appInstance){
        },
        destructor: function(){
        },
    }, {
        ATTRS: {
            component: {value: COMPONENT},
            templateBlockName: {value: 'widget'},
            parentTaskId: {value: 0}
        },
        CLICKS: {},
        parseURLParam: function(args){
            args = args || [];
            return {
                parentTaskId: (args[0] | 0)
            };
        }
    });
};


text:
<?php

// filename : module/Users/src/Users/Form/LoginForm.php

namespace Clients\Form;

use Zend\Form\Form;

class EditBookForm extends Form {

    public function __construct($name = null) {
        parent::__construct('Edit');
        $this->setAttribute('method', 'post');
        $this->setAttribute('enctype','multipart/form-data');
        $this->setAttribute('class', 'form-horizontal');
        $this->setAttribute('id', 'createBook');

        $this->add(array(
            'name' => 'id',
            'attributes' => array(
                'type' => 'hidden',
            ),
        ));

        $this->add(array(
            'name' => 'name',
            'attributes' => array(
                'type' => 'text',
                'class' => 'col-xs-10 col-sm-5',
                'id' => 'name',
                'placeholder' => 'Name',
            ),
            'options' => array(
//                'label' => 'Full Name',
            ),
        ));
        $this->add(array(
            'name' => 'submit',
            'attributes' => array(
                'type' => 'submit',
                'value' => 'Submit',
                'id' => 'submitbutton',
                'class' => 'btn btn-info submit',
            ),
        ));
    }

}


text:
>brianwilliams is a slackbot who turns Slack channels of your designation into read only channels. This bot is great for things posting team updates to a channel, while ensuring that the posts don't get drowned out by ambient channel noise.

## Getting Started

## Example Message

While the channels are read-only and all messages are immediately deleted, the bot is allowed to post to the channel and he won't delete his own posts. This is useful if you want to make a designated announcements channel that the bot can post to but everyone else's messages are deleted as to not distract from the announcements the bot posts. In order to post to a read-only channel via. the bot, send him a message with this format:

```
post to [channel name]
[post title]
___
[post message]
```

for example:

```
post to wooconf-announcements
Welcome to day one!
___
Enjoy the day!
```

You can use message formatting in the post message, and if you want create a post with two separate title/message combos, separate them with three line breaks like so:

```
post to wooconf-announcements
Message Title One
___
Message body one

Message Title Two
___
Message body two
```

## Built With

* [Botkit](https://github.com/howdyai/botkit)
* [slack api](https://api.slack.com/)

## Authors

* **Tyler Shambora** - [tshamz](https://github.com/tshamz)
* **Michael Tieso** - [michaeltieso](https://github.com/michaeltieso)

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details


text:
const { expect } = require('chai');

describe('promises inside sandbox', function () {
    this.timeout(1000 * 60);
    var Sandbox = require('../../lib');

    it('should set the execution to return async when a completed microtask includes a timer', function (done) {
        Sandbox.createContext({ debug: false }, function (err, ctx) {
            if (err) {
                return done(err);
            }

            var executionError = sinon.spy();

            ctx.on('execution.error', executionError);

            ctx.execute(`
                const message = new Promise((resolve) => {
                    resolve("test");
                });
                message.then((result) => {
                    setImmediate(() => { });
                });
            `,
            function (err, res) {
                if (err) {
                    return done(err);
                }

                expect(res).to.nested.include({
                    'return.async': true
                });

                expect(executionError).to.not.have.been.called;

                done();
            });
        });
    });

    it('should set the execution to return non-async when a completed microtask has no timer', function (done) {
        Sandbox.createContext({ debug: false }, function (err, ctx) {
            if (err) {
                return done(err);
            }

            var executionError = sinon.spy();

            ctx.on('execution.error', executionError);

            ctx.execute(`
                const message = new Promise((resolve) => {
                    resolve("test");
                });
                message.then((msg) => {
                    console.log(msg);
                });
            `,
            function (err, res) {
                if (err) {
                    return done(err);
                }

                expect(res).to.nested.include({
                    'return.async': false
                });

                expect(executionError).to.not.have.been.called;

                done();
            });
        });
    });

    it('should call assertions once resolved', function (done) {
        Sandbox.createContext({ debug: false }, function (err, ctx) {
            if (err) {
                return done(err);
            }

            var executionError = sinon.spy(),
                executionAssertion = sinon.spy();

            ctx.on('execution.error', executionError);
            ctx.on('execution.assertion', executionAssertion);

            ctx.execute(`
                pm.test('one test', function (done) {
                    const message = new Promise((resolve) => {
                        resolve();
                    });
                    message.then((result) => {
                        return new Promise((resolve) => {
                            setImmediate(() => resolve());
                        })
                    }).then(() => {
                        done();
                    });
                });
            `,
            function (err, res) {
                if (err) {
                    return done(err);
                }

                expect(res).to.nested.include({
                    'return.async': true
                });

                expect(executionError).to.not.have.been.called;

                expect(executionAssertion).to.have.been.calledOnce;

                expect(executionAssertion.args[0][0]).to.be.an('object').and.have.property('execution');
                expect(executionAssertion.args[0][1]).to.be.an('array').and.have.property('length', 1);
                expect(executionAssertion.args[0][1][0]).to.be.an('object')
                    .and.include({
                        passed: true,
                        async: true
                    });

                done();
            });
        });
    });

    it('should terminate script ' +
        'if async done is not called in a Promise', function (done) {
        Sandbox.createContext({ debug: false }, function (err, ctx) {
            if (err) { return done(err); }

            var executionError = sinon.spy(),
                executionAssertion = sinon.spy();

            ctx.on('execution.error', executionError);
            ctx.on('execution.assertion', executionAssertion);

            ctx.execute(`
                pm.test('one test', function (done) {
                    Promise.resolve(42).then(function () {
                        // done not called
                    });
                });
            `, function (err, res) {
                if (err) { return done(err); }

                expect(res).to.nested.include({
                    'return.async': false
                });
                expect(executionError).to.not.have.been.called;
                expect(executionAssertion).to.not.have.been.called;
                expect(err).to.be.null; // no error

                done();
            });
        });
    });

    it('should forward errors from a Promise', function (done) {
        Sandbox.createContext({ debug: false }, function (err, ctx) {
            if (err) { return done(err); }

            var executionError = sinon.spy(),
                executionAssertion = sinon.spy();

            ctx.on('execution.error', executionError);
            ctx.on('execution.assertion', executionAssertion);

            ctx.execute(`
                pm.test('one test', function (done) {
                    Promise.resolve('Catch me if you can').then((msg) => {
                        setImmediate(() => {
                            done(new Error(msg))
                        });
                    })
                });
            `, function (err) {
                if (err) { return done(err); }

                expect(executionError).to.not.have.been.called;
                expect(executionAssertion).to.have.been.calledOnce;

                expect(executionAssertion.args[0][0]).to.be.an('object').and.have.property('execution');
                expect(executionAssertion.args[0][1]).to.be.an('array').and.have.property('length', 1);
                expect(executionAssertion.args[0][1][0]).to.be.an('object')
                    .and.deep.include({
                        passed: false,
                        async: true,
                        error: {
                            type: 'Error',
                            name: 'Error',
                            message: 'Catch me if you can'
                        }
                    });
                done();
            });
        });
    });

    it('should forward synchronous ' +
        'errors from asynchronous Promise tests', function (done) {
        Sandbox.createContext({ debug: false }, function (err, ctx) {
            if (err) { return done(err); }

            var executionError = sinon.spy(),
                executionAssertion = sinon.spy();

            ctx.on('execution.error', executionError);
            ctx.on('execution.assertion', executionAssertion);

            ctx.execute(`
                pm.test('one test', function (done) {
                    new Promise((resolve) => {
                        resolve('Catch me if you can');
                    }).then((msg) => {
                        setImmediate(() => {
                            done(new Error(msg));
                        });
                    })

                    throw new Error('there is no right way to do something wrong');
                });
            `, function (err) {
                if (err) { return done(err); }

                expect(executionError).to.not.have.been.called;
                expect(executionAssertion).to.have.been.calledOnce;

                expect(executionAssertion.args[0][0]).to.be.an('object').and.have.property('execution');
                expect(executionAssertion.args[0][1]).to.be.an('array').and.have.property('length', 1);
                expect(executionAssertion.args[0][1][0]).to.be.an('object')
                    .and.deep.include({
                        passed: false,
                        async: true,
                        error: {
                            type: 'Error',
                            name: 'Error',
                            message: 'there is no right way to do something wrong'
                        }
                    });
                done();
            });
        });
    });

    it('runs consecutive Promises when an async function executes in a microtask queue', function (done) {
        Sandbox.createContext({}, function (err, ctx) {
            if (err) { return done(err); }

            var executionError = sinon.spy(),
                onConsole = sinon.spy();

            ctx.on('execution.error', executionError);
            ctx.on('console', onConsole);

            ctx.execute(`
                const foo = () => new Promise((resolve) => {
                    console.log('foo');
                    setTimeout(resolve, 200);
                });

                const bar = () => new Promise((resolve) => {
                    console.log('bar');
                    resolve();
                });

                const baz = () => new Promise((resolve) => {
                    console.log('baz');
                    resolve();
                });

                Promise.resolve()
                    .then(() => foo())
                    .then(() => bar())
                    .then(() => baz());
            `, function (err) {
                if (err) { return done(err); }

                expect(executionError).to.not.have.been.called;
                expect(onConsole).to.have.callCount(3);
                done();
            });
        });
    });

    it('runs consecutive Promises when an async function executes in a microtask queue (async/await)', function (done) {
        Sandbox.createContext({}, function (err, ctx) {
            if (err) { return done(err); }

            var executionError = sinon.spy(),
                onConsole = sinon.spy();

            ctx.on('execution.error', executionError);
            ctx.on('console', onConsole);

            ctx.execute(`
                const foo = () => new Promise((resolve) => {
                    console.log('foo');
                    setTimeout(resolve, 200);
                });

                const bar = () => new Promise((resolve) => {
                    console.log('bar');
                    resolve();
                });

                const baz = () => new Promise((resolve) => {
                    console.log('baz');
                    resolve();
                });

                (async function main() {
                  await Promise.resolve()
                  await foo();
                  await bar();
                  await baz();
                })();
            `, function (err) {
                if (err) { return done(err); }

                expect(executionError).to.not.have.been.called;
                expect(onConsole).to.have.callCount(3);
                done();
            });
        });
    });
});


text:
using DragonSpark.Sources;
using DragonSpark.Sources.Parameterized;
using System;
using System.Configuration;
using System.IO;

namespace DragonSpark.Windows.Setup
{
	public static class Defaults
	{
		public static Func<FileInfo> UserSettingsPath { get; } = UserSettingsFile.Default.Fixed( ConfigurationUserLevel.PerUserRoamingAndLocal ).ToDelegate();
	}
}


text:
/**
 * Collection of a User's groups.
 */
cdb.admin.UserGroups = Backbone.Collection.extend({

  model: cdb.admin.Group,

  initialize: function(models, opts) {
    this.organization = opts.organization;
  }

});


text:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <TextView
        android:id="@+id/titleTextView"
        android:layout_width="150dip"
        android:layout_height="60dip"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:text="Item"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:textSize="48dp" />

    <TextView
        android:id="@+id/occursText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/titleTextView"
        android:text="Occured on:  "
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <TextView
        android:id="@+id/expenseDateView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/occursText"
        android:layout_alignParentRight="true"
        android:layout_alignTop="@+id/occursText"
        android:layout_toRightOf="@+id/occursText"
        android:text="Date"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <TextView
        android:id="@+id/catView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/categoryText"
        android:layout_alignBottom="@+id/categoryText"
        android:layout_alignParentRight="true"
        android:layout_toRightOf="@+id/occursText"
        android:text="Large Text"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <TextView
        android:id="@+id/descView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/editExpButton"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/describeText"
        android:text="Large Text"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <TextView
        android:id="@+id/dollarSign"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/amount"
        android:layout_alignBottom="@+id/amount"
        android:layout_alignParentLeft="true"
        android:layout_toLeftOf="@+id/amount"
        android:text="$"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <TextView
        android:id="@+id/CurrencyTExt"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/amount"
        android:layout_alignBottom="@+id/amount"
        android:layout_alignParentRight="true"
        android:layout_toRightOf="@+id/amount"
        android:text="Currency"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <Button
        android:id="@+id/backButton2"
        android:layout_width="wrap_content"
        android:layout_height="100dip"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:onClick="returnAction"
        android:text="Expense Items" />

    <Button
        android:id="@+id/editExpButton"
        android:layout_width="wrap_content"
        android:layout_height="100dip"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:layout_toRightOf="@+id/backButton2"
        android:onClick="editExpenseClaimAction"
        android:text="Edit" />

    <TextView
        android:id="@+id/describeText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true"
        android:text="Description:"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <TextView
        android:id="@+id/amount"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/describeText"
        android:layout_alignRight="@+id/categoryText"
        android:layout_marginBottom="24dp"
        android:text="Amount"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <TextView
        android:id="@+id/categoryText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/dollarSign"
        android:layout_alignParentLeft="true"
        android:layout_marginBottom="26dp"
        android:text="Category:"
        android:textAppearance="?android:attr/textAppearanceLarge" />

</RelativeLayout>


text:
'use strict';
goog.provide('modules.shared.glsShaderLibrary');
goog.require('framework.common.tcuTestCase');
goog.require('framework.opengl.gluShaderUtil');
goog.require('modules.shared.glsShaderLibraryCase');

goog.scope(function() {

var glsShaderLibrary = modules.shared.glsShaderLibrary;
var tcuTestCase = framework.common.tcuTestCase;
var glsShaderLibraryCase = modules.shared.glsShaderLibraryCase;
var gluShaderUtil = framework.opengl.gluShaderUtil;

    glsShaderLibrary.generateTestCases = function() {
    /** @type {glsShaderLibrary.Parser} */ var parser = new glsShaderLibrary.Parser();
        try {
        /** @type {Object} */ var state = tcuTestCase.runner;
            var tree = parser.parse(state.testFile);
            var rootTest = tcuTestCase.newTest(state.testName, 'Top level');
            rootTest.setChildren(tree);
            state.setRoot(rootTest);
        }
        catch (err) {
            console.log(err);
            bufferedLogToConsole(err);
            return false;
        }
        return true;
    };

    glsShaderLibrary.processTestFile = function() {
        if (glsShaderLibrary.generateTestCases()) {
            tcuTestCase.runner.runCallback(glsShaderLibraryCase.runTestCases);
        } else {
            tcuTestCase.runner.terminate();
        }
    };

    glsShaderLibrary.isWhitespace = function(value) {
        return /^[ \t\r\n]+$/.test(value);
    };
    glsShaderLibrary.isEOL = function(value) {
        return /^[\r\n]+$/.test(value);
    };
    glsShaderLibrary.isAlpha = function(value) {
        return /^[a-zA-Z]$/.test(value);
    };
    glsShaderLibrary.isNumeric = function(value) {
        return /^[0-9]$/.test(value);
    };
    glsShaderLibrary.isCaseNameChar = function(value) {
        return /^[a-zA-Z0-9_\-\.]$/.test(value);
    };

    /**
     * Removes however many indents there are on the first line from all lines.
     * @param {string} str
     * @return {string} output
     */
    glsShaderLibrary.removeExtraIndentation = function(str) {
        return glsShaderLibrary.removeExtraIndentationArray(
            str.split(/\r\n|\r|\n/)
        ).join('\n');
    };

    /**
     * Returns an array of strings without indentation.
     * @param {Array<string>} arr
     * @return {Array<string>} output
     */
    glsShaderLibrary.removeExtraIndentationArray = function(arr) {
    /** @type {Array<string>} */ var output = [];

        if (arr.length) {

        /** @type {number} */ var numIndentChars = 0;
            for (var i = 0; i < arr[0].length && glsShaderLibrary.isWhitespace(arr[0].charAt(i)); ++i) {
                numIndentChars += arr[0].charAt(i) === '\t' ? 4 : 1;
            }

            for (var i = 0; i < arr.length; ++i) {
            /** @type {number} */ var removed = 0;
            /** @type {number} */ var j;
                for (j = 0; removed < numIndentChars && j < arr[i].length; ++j) {
                    removed += (arr[i].charAt(j) === '\t' ? 4 : 1);
                }

                output.push(arr[i].substr(j, arr[i].length - j));
            }

        }

        return output;
    };

    glsShaderLibrary.de_assert = function(condition) {
        if (!condition) {
            throw Error();
        }
    };

    /**
     * @param {string} str
     * @param {string} endstr end of string character
     * @return {string} str
     * @private
     */
    glsShaderLibrary.parseStringLiteralHelper = function(str, endstr) {

    /** @type {number} */ var index_end = 0;
        // isolate the string
        do {
            index_end = str.indexOf(endstr, index_end + 1);
        } while (index_end >= 0 && str.charAt(index_end - 1) === '\\');

        if (index_end <= 0) {
            index_end = str.length;
        }

        // strip quotes, replace \n and \t with nl and tabs respectively
        return str
            .substr(endstr.length, index_end - endstr.length)
            .replace('\\n', '\n')
            .replace('\\t', '\t')
            .replace(/\\/g, '');

    };

    /**
     * glsShaderLibrary.Parser class
     * @constructor
     */
    glsShaderLibrary.Parser = function() {

    /* data members */

        /**
         * The Token constants
         * @enum {number}
         */
        var Token = {
            TOKEN_INVALID: 0,
            TOKEN_EOF: 1,
            TOKEN_STRING: 2,
            TOKEN_SHADER_SOURCE: 3,

            TOKEN_INT_LITERAL: 4,
            TOKEN_FLOAT_LITERAL: 5,

            // identifiers
            TOKEN_IDENTIFIER: 6,
            TOKEN_TRUE: 7,
            TOKEN_FALSE: 8,
            TOKEN_DESC: 9,
            TOKEN_EXPECT: 10,
            TOKEN_GROUP: 11,
            TOKEN_CASE: 12,
            TOKEN_END: 13,
            TOKEN_VALUES: 14,
            TOKEN_BOTH: 15,
            TOKEN_VERTEX: 26,
            TOKEN_FRAGMENT: 17,
            TOKEN_UNIFORM: 18,
            TOKEN_INPUT: 19,
            TOKEN_OUTPUT: 20,
            TOKEN_FLOAT: 21,
            TOKEN_FLOAT_VEC2: 22,
            TOKEN_FLOAT_VEC3: 23,
            TOKEN_FLOAT_VEC4: 24,
            TOKEN_FLOAT_MAT2: 25,
            TOKEN_FLOAT_MAT2X3: 26,
            TOKEN_FLOAT_MAT2X4: 27,
            TOKEN_FLOAT_MAT3X2: 28,
            TOKEN_FLOAT_MAT3: 29,
            TOKEN_FLOAT_MAT3X4: 30,
            TOKEN_FLOAT_MAT4X2: 31,
            TOKEN_FLOAT_MAT4X3: 32,
            TOKEN_FLOAT_MAT4: 33,
            TOKEN_INT: 34,
            TOKEN_INT_VEC2: 35,
            TOKEN_INT_VEC3: 36,
            TOKEN_INT_VEC4: 37,
            TOKEN_UINT: 38,
            TOKEN_UINT_VEC2: 39,
            TOKEN_UINT_VEC3: 40,
            TOKEN_UINT_VEC4: 41,
            TOKEN_BOOL: 42,
            TOKEN_BOOL_VEC2: 43,
            TOKEN_BOOL_VEC3: 44,
            TOKEN_BOOL_VEC4: 45,
            TOKEN_VERSION: 46,

            // symbols
            TOKEN_ASSIGN: 47,
            TOKEN_PLUS: 48,
            TOKEN_MINUS: 49,
            TOKEN_COMMA: 50,
            TOKEN_VERTICAL_BAR: 51,
            TOKEN_SEMI_COLON: 52,
            TOKEN_LEFT_PAREN: 53,
            TOKEN_RIGHT_PAREN: 54,
            TOKEN_LEFT_BRACKET: 55,
            TOKEN_RIGHT_BRACKET: 56,
            TOKEN_LEFT_BRACE: 57,
            TOKEN_RIGHT_BRACE: 58,

            TOKEN_LAST: 59
        };

        /** @type {string} */ var m_input = '';
        /** @type {number} */ var m_curPtr = 0;
        /** @type {number} */ var m_curToken;// = Token.TOKEN_INVALID;
        /** @type {string} */ var m_curTokenStr = '';

        /* function members */
        this.parse = function(input) {

            // initialise parser
            m_input = input;
            m_curPtr = 0;
            m_curToken = Token.TOKEN_INVALID;
            m_curTokenStr = '';
            advanceToken();

            /** @type {Array<tcuTestCase.DeqpTest>} */ var nodeList = [];

            for (;;) {

                if (m_curToken === Token.TOKEN_CASE) {
                    parseShaderCase(nodeList);
                } else if (m_curToken === Token.TOKEN_GROUP) {
                    parseShaderGroup(nodeList);
                } else if (m_curToken === Token.TOKEN_EOF) {
                    break;
                } else {
                //    throw Error("invalid token encountered at main level: '" + m_curTokenStr + "'");
                    testFailed("invalid token encountered at main level: '" + m_curTokenStr + "'");
                    tcuTestCase.runner.terminate();
                }

            }

            return nodeList;

        };

        /**
         * ensures that the token exists
         * otherwise it returns the corresponding token's name depending on enum number value
         * @param {number} id
         * @return {string} name
         */
        var resolveTokenName = function(id) {
            for (var name in Token) {
                if (Token[name] === id) return name;
            }
            return 'TOKEN_UNKNOWN';
        };

        /**
         * Throws an error which contains the passed string
         * @param {string} errorStr that contains an error to notify
         * @return {string} error
         */
        var parseError = function(errorStr) {
            // abort
            throw 'glsShaderLibrary.Parser error: ' + errorStr + ' near ' + m_input.substr(m_curPtr, m_curPtr + 80);
        };

        /**
         * Converts string into float
         * @param {string} str
         * @return {number}
         */
        var parseFloatLiteral = function(str) {
            return parseFloat(str);
        };

        /**
         * Converts string into integer
         * @param {string} str
         * @return {number}
         */
        var parseIntLiteral = function(str) {
            return parseInt(str, 10);
        };
        var parseStringLiteral = function(str) {
        /**
        * @type {string}
        * find delimitor
        */ var endchar = str.substr(0, 1);
            return glsShaderLibrary.parseStringLiteralHelper(str, endchar);
        };
        var parseShaderSource = function(str) {
            // similar to parse literal, delimitors are two double quotes ("")
            return glsShaderLibrary.removeExtraIndentation(
                glsShaderLibrary.parseStringLiteralHelper(str, '""')
            );
        };

        var advanceTokenWorker = function() {

            // Skip old token
            m_curPtr += m_curTokenStr.length;

            // Reset token (for safety).
            m_curToken = Token.TOKEN_INVALID;
            m_curTokenStr = '';

            // Eat whitespace & comments while they last.
            for (;;) {

                while (glsShaderLibrary.isWhitespace(m_input.charAt(m_curPtr))) ++m_curPtr;

                // check for EOL comment
                if (m_input.charAt(m_curPtr) === '#') {
                    // if m_input is to be an array of lines then this probably wont work very well
                    while (
                        m_curPtr < m_input.length &&
                        !glsShaderLibrary.isEOL(m_input.charAt(m_curPtr))
                    ) ++m_curPtr;
                } else {
                    break;
                }

            }

            if (m_curPtr >= m_input.length) {

                m_curToken = Token.TOKEN_EOF;
                m_curTokenStr = '<EOF>';

            } else if (glsShaderLibrary.isAlpha(m_input.charAt(m_curPtr))) {

            /** @type {number} */ var end = m_curPtr + 1;
                while (glsShaderLibrary.isCaseNameChar(m_input.charAt(end))) ++end;

                m_curTokenStr = m_input.substr(m_curPtr, end - m_curPtr);

                m_curToken = (function() {
                    // consider reimplementing with a binary search
                    switch (m_curTokenStr) {
                        case 'true': return Token.TOKEN_TRUE;
                        case 'false': return Token.TOKEN_FALSE;
                        case 'desc': return Token.TOKEN_DESC;
                        case 'expect': return Token.TOKEN_EXPECT;
                        case 'group': return Token.TOKEN_GROUP;
                        case 'case': return Token.TOKEN_CASE;
                        case 'end': return Token.TOKEN_END;
                        case 'values': return Token.TOKEN_VALUES;
                        case 'both': return Token.TOKEN_BOTH;
                        case 'vertex': return Token.TOKEN_VERTEX;
                        case 'fragment': return Token.TOKEN_FRAGMENT;
                        case 'uniform': return Token.TOKEN_UNIFORM;
                        case 'input': return Token.TOKEN_INPUT;
                        case 'output': return Token.TOKEN_OUTPUT;
                        case 'float': return Token.TOKEN_FLOAT;
                        case 'vec2': return Token.TOKEN_FLOAT_VEC2;
                        case 'vec3': return Token.TOKEN_FLOAT_VEC3;
                        case 'vec4': return Token.TOKEN_FLOAT_VEC4;
                        case 'mat2': return Token.TOKEN_FLOAT_MAT2;
                        case 'mat2x3': return Token.TOKEN_FLOAT_MAT2X3;
                        case 'mat2x4': return Token.TOKEN_FLOAT_MAT2X4;
                        case 'mat3x2': return Token.TOKEN_FLOAT_MAT3X2;
                        case 'mat3': return Token.TOKEN_FLOAT_MAT3;
                        case 'mat3x4': return Token.TOKEN_FLOAT_MAT3X4;
                        case 'mat4x2': return Token.TOKEN_FLOAT_MAT4X2;
                        case 'mat4x3': return Token.TOKEN_FLOAT_MAT4X3;
                        case 'mat4': return Token.TOKEN_FLOAT_MAT4;
                        case 'int': return Token.TOKEN_INT;
                        case 'ivec2': return Token.TOKEN_INT_VEC2;
                        case 'ivec3': return Token.TOKEN_INT_VEC3;
                        case 'ivec4': return Token.TOKEN_INT_VEC4;
                        case 'uint': return Token.TOKEN_UINT;
                        case 'uvec2': return Token.TOKEN_UINT_VEC2;
                        case 'uvec3': return Token.TOKEN_UINT_VEC3;
                        case 'uvec4': return Token.TOKEN_UINT_VEC4;
                        case 'bool': return Token.TOKEN_BOOL;
                        case 'bvec2': return Token.TOKEN_BOOL_VEC2;
                        case 'bvec3': return Token.TOKEN_BOOL_VEC3;
                        case 'bvec4': return Token.TOKEN_BOOL_VEC4;
                        case 'version': return Token.TOKEN_VERSION;
                        default: return Token.TOKEN_IDENTIFIER;
                    }
                }());

            } else if (glsShaderLibrary.isNumeric(m_input.charAt(m_curPtr))) {

            /** @type {number} */ var p = m_curPtr;
                while (glsShaderLibrary.isNumeric(m_input.charAt(p))) ++p;

                if (m_input.charAt(p) === '.') { // float

                    ++p;
                    while (glsShaderLibrary.isNumeric(m_input.charAt(p))) ++p;

                    if (m_input.charAt(p) === 'e' || m_input.charAt(p) === 'E') {

                        ++p;
                        if (m_input.charAt(p) === '+' || m_input.charAt(p) === '-') ++p;

                        glsShaderLibrary.de_assert(p < m_input.length && glsShaderLibrary.isNumeric(m_input.charAt(p)));
                        while (glsShaderLibrary.isNumeric(m_input.charAt(p))) ++p;

                    }

                    m_curToken = Token.TOKEN_FLOAT_LITERAL;
                    m_curTokenStr = m_input.substr(m_curPtr, p - m_curPtr);

                } else {

                    m_curToken = Token.TOKEN_INT_LITERAL;
                    m_curTokenStr = m_input.substr(m_curPtr, p - m_curPtr);

                }

            } else if (m_input.charAt(m_curPtr) === '"' && m_input.charAt(m_curPtr + 1) === '"') { // shader source

                var p = m_curPtr + 2;

                while (m_input.charAt(p) != '"' || m_input.charAt(p + 1) != '"') {
                    glsShaderLibrary.de_assert(p < m_input.length);
                    if (m_input.charAt(p) === '\\') {
                        glsShaderLibrary.de_assert(p + 1 < m_input.length);
                        p += 2;
                    } else {
                        ++p;
                    }
                }
                p += 2;

                m_curToken = Token.TOKEN_SHADER_SOURCE;
                m_curTokenStr = m_input.substr(m_curPtr, p - m_curPtr);

            } else if (m_input.charAt(m_curPtr) === '"' || m_input.charAt(m_curPtr) === "'") {

                /** @type {string} */ var delimitor = m_input.charAt(m_curPtr);
                var p = m_curPtr + 1;

                while (m_input.charAt(p) != delimitor) {

                    glsShaderLibrary.de_assert(p < m_input.length);
                    if (m_input.charAt(p) === '\\') {
                        glsShaderLibrary.de_assert(p + 1 < m_input.length);
                        p += 2;
                    } else {
                        ++p;
                    }

                }
                ++p;

                m_curToken = Token.TOKEN_STRING;
                m_curTokenStr = m_input.substr(m_curPtr, p - m_curPtr);

            } else {

                m_curTokenStr = m_input.charAt(m_curPtr);
                m_curToken = (function() {
                    // consider reimplementing with a binary search
                    switch (m_curTokenStr) {
                        case '=': return Token.TOKEN_ASSIGN;
                        case '+': return Token.TOKEN_PLUS;
                        case '-': return Token.TOKEN_MINUS;
                        case ',': return Token.TOKEN_COMMA;
                        case '|': return Token.TOKEN_VERTICAL_BAR;
                        case ';': return Token.TOKEN_SEMI_COLON;
                        case '(': return Token.TOKEN_LEFT_PAREN;
                        case ')': return Token.TOKEN_RIGHT_PAREN;
                        case '[': return Token.TOKEN_LEFT_BRACKET;
                        case ']': return Token.TOKEN_RIGHT_BRACKET;
                        case '{': return Token.TOKEN_LEFT_BRACE;
                        case '}': return Token.TOKEN_RIGHT_BRACE;

                        default: return Token.TOKEN_INVALID;
                    }
                }());

            }

        };

        /**
         * @return {Object.<number, string, string>}
         */
        var advanceTokenTester = function(input, current_index) {
            m_input = input;
            m_curPtr = current_index;
            m_curTokenStr = '';
            advanceTokenWorker();
            return {
            /** @type {number} */ idType: m_curToken,
            /** @type {string} */ name: resolveTokenName(m_curToken),
            /** @type {string} */ value: m_curTokenStr
            };
        };

        /**
          * @param {Token=} tokenAssumed
          */
        var advanceToken = function(tokenAssumed) {
            if (typeof(tokenAssumed) !== 'undefined') {
                assumeToken(tokenAssumed);
            }
            advanceTokenWorker();
        };
        var assumeToken = function(token) {

            if (m_curToken != token) {
                // parse error
            /** @type {string} */ var msg = "unexpected token '" + m_curTokenStr + "', expecting '" + getTokenName(token) + "'";
                throw Error('Parse Error. ' + msg + ' near ' + m_curPtr + ' ...');
            }
        };
        var mapDataTypeToken = function(token) {
            switch (token) {
                case Token.TOKEN_FLOAT: return gluShaderUtil.DataType.FLOAT;
                case Token.TOKEN_FLOAT_VEC2: return gluShaderUtil.DataType.FLOAT_VEC2;
                case Token.TOKEN_FLOAT_VEC3: return gluShaderUtil.DataType.FLOAT_VEC3;
                case Token.TOKEN_FLOAT_VEC4: return gluShaderUtil.DataType.FLOAT_VEC4;
                case Token.TOKEN_FLOAT_MAT2: return gluShaderUtil.DataType.FLOAT_MAT2;
                case Token.TOKEN_FLOAT_MAT2X3: return gluShaderUtil.DataType.FLOAT_MAT2X3;
                case Token.TOKEN_FLOAT_MAT2X4: return gluShaderUtil.DataType.FLOAT_MAT2X4;
                case Token.TOKEN_FLOAT_MAT3X2: return gluShaderUtil.DataType.FLOAT_MAT3X2;
                case Token.TOKEN_FLOAT_MAT3: return gluShaderUtil.DataType.FLOAT_MAT3;
                case Token.TOKEN_FLOAT_MAT3X4: return gluShaderUtil.DataType.FLOAT_MAT3X4;
                case Token.TOKEN_FLOAT_MAT4X2: return gluShaderUtil.DataType.FLOAT_MAT4X2;
                case Token.TOKEN_FLOAT_MAT4X3: return gluShaderUtil.DataType.FLOAT_MAT4X3;
                case Token.TOKEN_FLOAT_MAT4: return gluShaderUtil.DataType.FLOAT_MAT4;
                case Token.TOKEN_INT: return gluShaderUtil.DataType.INT;
                case Token.TOKEN_INT_VEC2: return gluShaderUtil.DataType.INT_VEC2;
                case Token.TOKEN_INT_VEC3: return gluShaderUtil.DataType.INT_VEC3;
                case Token.TOKEN_INT_VEC4: return gluShaderUtil.DataType.INT_VEC4;
                case Token.TOKEN_UINT: return gluShaderUtil.DataType.UINT;
                case Token.TOKEN_UINT_VEC2: return gluShaderUtil.DataType.UINT_VEC2;
                case Token.TOKEN_UINT_VEC3: return gluShaderUtil.DataType.UINT_VEC3;
                case Token.TOKEN_UINT_VEC4: return gluShaderUtil.DataType.UINT_VEC4;
                case Token.TOKEN_BOOL: return gluShaderUtil.DataType.BOOL;
                case Token.TOKEN_BOOL_VEC2: return gluShaderUtil.DataType.BOOL_VEC2;
                case Token.TOKEN_BOOL_VEC3: return gluShaderUtil.DataType.BOOL_VEC3;
                case Token.TOKEN_BOOL_VEC4: return gluShaderUtil.DataType.BOOL_VEC4;
                default: return gluShaderUtil.DataType.INVALID;
            }
        };

        /**
         * Returns the corresponding token's name depending on enum number value
         * @param {number} token
         * @return {string}
         */
        var getTokenName = function(token) {
            switch (token) {
                case Token.TOKEN_INVALID: return '<invalid>';
                case Token.TOKEN_EOF: return '<eof>';
                case Token.TOKEN_STRING: return '<string>';
                case Token.TOKEN_SHADER_SOURCE: return 'source';

                case Token.TOKEN_INT_LITERAL: return '<int>';
                case Token.TOKEN_FLOAT_LITERAL: return '<float>';

                // identifiers
                case Token.TOKEN_IDENTIFIER: return '<identifier>';
                case Token.TOKEN_TRUE: return 'true';
                case Token.TOKEN_FALSE: return 'false';
                case Token.TOKEN_DESC: return 'desc';
                case Token.TOKEN_EXPECT: return 'expect';
                case Token.TOKEN_GROUP: return 'group';
                case Token.TOKEN_CASE: return 'case';
                case Token.TOKEN_END: return 'end';
                case Token.TOKEN_VALUES: return 'values';
                case Token.TOKEN_BOTH: return 'both';
                case Token.TOKEN_VERTEX: return 'vertex';
                case Token.TOKEN_FRAGMENT: return 'fragment';
                case Token.TOKEN_UNIFORM: return 'uniform';
                case Token.TOKEN_INPUT: return 'input';
                case Token.TOKEN_OUTPUT: return 'output';
                case Token.TOKEN_FLOAT: return 'float';
                case Token.TOKEN_FLOAT_VEC2: return 'vec2';
                case Token.TOKEN_FLOAT_VEC3: return 'vec3';
                case Token.TOKEN_FLOAT_VEC4: return 'vec4';
                case Token.TOKEN_FLOAT_MAT2: return 'mat2';
                case Token.TOKEN_FLOAT_MAT2X3: return 'mat2x3';
                case Token.TOKEN_FLOAT_MAT2X4: return 'mat2x4';
                case Token.TOKEN_FLOAT_MAT3X2: return 'mat3x2';
                case Token.TOKEN_FLOAT_MAT3: return 'mat3';
                case Token.TOKEN_FLOAT_MAT3X4: return 'mat3x4';
                case Token.TOKEN_FLOAT_MAT4X2: return 'mat4x2';
                case Token.TOKEN_FLOAT_MAT4X3: return 'mat4x3';
                case Token.TOKEN_FLOAT_MAT4: return 'mat4';
                case Token.TOKEN_INT: return 'int';
                case Token.TOKEN_INT_VEC2: return 'ivec2';
                case Token.TOKEN_INT_VEC3: return 'ivec3';
                case Token.TOKEN_INT_VEC4: return 'ivec4';
                case Token.TOKEN_UINT: return 'uint';
                case Token.TOKEN_UINT_VEC2: return 'uvec2';
                case Token.TOKEN_UINT_VEC3: return 'uvec3';
                case Token.TOKEN_UINT_VEC4: return 'uvec4';
                case Token.TOKEN_BOOL: return 'bool';
                case Token.TOKEN_BOOL_VEC2: return 'bvec2';
                case Token.TOKEN_BOOL_VEC3: return 'bvec3';
                case Token.TOKEN_BOOL_VEC4: return 'bvec4';

                case Token.TOKEN_ASSIGN: return '=';
                case Token.TOKEN_PLUS: return '+';
                case Token.TOKEN_MINUS: return '-';
                case Token.TOKEN_COMMA: return ',';
                case Token.TOKEN_VERTICAL_BAR: return '|';
                case Token.TOKEN_SEMI_COLON: return ';';
                case Token.TOKEN_LEFT_PAREN: return '(';
                case Token.TOKEN_RIGHT_PAREN: return ')';
                case Token.TOKEN_LEFT_BRACKET: return '[';
                case Token.TOKEN_RIGHT_BRACKET: return ']';
                case Token.TOKEN_LEFT_BRACE: return ' {';
                case Token.TOKEN_RIGHT_BRACE: return '}';

                default: return '<unknown>';
            }
        };

        /**
         * @param {?gluShaderUtil.DataType} expectedDataType
         * @param {Object} result
         */
        var parseValueElement = function(expectedDataType, result) {
            /** @type {?string} */ var scalarType = null;
            /** @type {number} */ var scalarSize = 0;
            if (expectedDataType) {
                scalarType = gluShaderUtil.getDataTypeScalarType(expectedDataType);
                scalarSize = gluShaderUtil.getDataTypeScalarSize(expectedDataType);
            }

            /** @type {Array<number>} */ var elems = [];

            if (scalarSize > 1) {
                glsShaderLibrary.de_assert(mapDataTypeToken(m_curToken) === expectedDataType);
                advanceToken(); // data type(float, vec2, etc.)
                advanceToken(Token.TOKEN_LEFT_PAREN);
            }

            for (var i = 0; i < scalarSize; ++i) {
                if (scalarType === 'float') {

                /** @type {number} */ var signMult = 1.0;
                    if (m_curToken === Token.TOKEN_MINUS) {
                        signMult = -1.0;
                        advanceToken();
                    }

                    assumeToken(Token.TOKEN_FLOAT_LITERAL);
                    elems.push(signMult * parseFloatLiteral(m_curTokenStr));
                    advanceToken(Token.TOKEN_FLOAT_LITERAL);

                } else if (scalarType === 'int' || scalarType === 'uint') {

                    var signMult = 1;
                    if (m_curToken === Token.TOKEN_MINUS) {
                        signMult = -1;
                        advanceToken();
                    }

                    assumeToken(Token.TOKEN_INT_LITERAL);
                    elems.push(signMult * parseIntLiteral(m_curTokenStr));
                    advanceToken(Token.TOKEN_INT_LITERAL);

                } else {

                    glsShaderLibrary.de_assert(scalarType === 'bool');
                    elems.push(m_curToken === Token.TOKEN_TRUE);
                    if (m_curToken != Token.TOKEN_TRUE && m_curToken != Token.TOKEN_FALSE) {
                        throw Error('unexpected token, expecting bool: ' + m_curTokenStr);
                    }
                    advanceToken(); // true/false

                }

                if (i != (scalarSize - 1)) {
                    advanceToken(Token.TOKEN_COMMA);
                }
            }

            if (scalarSize > 1) {
                advanceToken(Token.TOKEN_RIGHT_PAREN);
            }

            for (var i = 0; i < elems.length; i++)
                result.elements.push(elems[i]);

        };

        /**
         * @param {Object.<Array, number>} valueBlock
         */
        var parseValue = function(valueBlock) {

        /**
        * @type {Object}
        */
            var result = {
            /** @type {?gluShaderUtil.DataType} */ dataType: null,
            /** @type {?glsShaderLibraryCase.shaderCase} */ storageType: null,
            /** @type {?string} */ valueName: null,
            /** @type {Array} */ elements: []
            };

            // parse storage
            switch (m_curToken) {
             case Token.TOKEN_UNIFORM:
                result.storageType = glsShaderLibraryCase.shaderCase.STORAGE_UNIFORM;
                break;
             case Token.TOKEN_INPUT:
                result.storageType = glsShaderLibraryCase.shaderCase.STORAGE_INPUT;
                break;
             case Token.TOKEN_OUTPUT:
                result.storageType = glsShaderLibraryCase.shaderCase.STORAGE_OUTPUT;
                break;
             default:
                throw Error('unexpected token encountered when parsing value classifier');
                break;
            }
            advanceToken();

            // parse data type
            result.dataType = mapDataTypeToken(m_curToken);
            if (result.dataType === gluShaderUtil.DataType.INVALID) {
                throw Error('unexpected token when parsing value data type: ' + m_curTokenStr);
            }
            advanceToken();

            // parse value name
            if (m_curToken === Token.TOKEN_IDENTIFIER) {
                result.valueName = m_curTokenStr;
            } else if (m_curToken === Token.TOKEN_STRING) {
                result.valueName = parseStringLiteral(m_curTokenStr);
            } else {
                throw Error('unexpected token when parsing value name: ' + m_curTokenStr);
            }
            advanceToken();

            // parse assignment operator.
            advanceToken(Token.TOKEN_ASSIGN);

            // parse actual value
            if (m_curToken === Token.TOKEN_LEFT_BRACKET) { // value list
                advanceToken(Token.TOKEN_LEFT_BRACKET);
                result.arrayLength = 0;

                for (;;) {
                    parseValueElement(result.dataType, result);
                    result.arrayLength += 1;

                    if (m_curToken === Token.TOKEN_RIGHT_BRACKET) {
                        break;
                    } else if (m_curToken === Token.TOKEN_VERTICAL_BAR) { // pipe?
                        advanceToken();
                        continue;
                    } else {
                        throw Error('unexpected token in value element array: ' + m_curTokenStr);
                    }
                }

                advanceToken(Token.TOKEN_RIGHT_BRACKET);

            } else { // arrays, single elements
                parseValueElement(result.dataType, result);
                result.arrayLength = 1;
            }

            advanceToken(Token.TOKEN_SEMI_COLON);

            valueBlock.values.push(result);

        };

        /**
         * @param {Object.<Array, number>} valueBlock
         */
        var parseValueBlock = function(valueBlock) {

            advanceToken(Token.TOKEN_VALUES);
            advanceToken(Token.TOKEN_LEFT_BRACE);

            for (;;) {
                if (
                    m_curToken === Token.TOKEN_UNIFORM ||
                    m_curToken === Token.TOKEN_INPUT ||
                    m_curToken === Token.TOKEN_OUTPUT
                ) {
                    parseValue(valueBlock);
                } else if (m_curToken === Token.TOKEN_RIGHT_BRACE) {
                    break;
                } else {
                    throw Error('unexpected( token when parsing a value block: ' + m_curTokenStr);
                }
            }

            advanceToken(Token.TOKEN_RIGHT_BRACE);

            /** @type {number} */ var arrayLength = 1;
            // compute combined array length of value block.
            for (var i = 0; i < valueBlock.values.length; ++i) {
                if (valueBlock.values[i].arrayLength > 1) {
                    glsShaderLibrary.de_assert(arrayLength === 1 || arrayLength === valueBlock.values[i].arrayLength);
                    arrayLength = valueBlock.values[i].arrayLength;
                }
            }

            valueBlock.arrayLength = arrayLength;

        };

        /**
         * @param {Array<tcuTestCase.DeqpTest>} shaderNodeList
         */
        var parseShaderCase = function(shaderNodeList) {

            // parse case
            advanceToken(Token.TOKEN_CASE);

            /**
             * @type {string}
             * parse case name
             */
            var caseName = m_curTokenStr;
            advanceToken(); // \note [pyry] All token types are allowed here.

            /**
             * @type {Array<Object>}
             * setup case
             */
            var valueBlockList = [];

            /** TODO: Should the default version be defined elsewhere? */
            /** @type {string} */ var version = '100';
            /** @type {number} */ var expectResult = glsShaderLibraryCase.expectResult.EXPECT_PASS;
            /** @type {string} */ var description;
            /** @type {string} */ var bothSource = '';
            /** @type {string} */ var vertexSource = '';
            /** @type {string} */ var fragmentSource = '';

            for (;;) {

                if (m_curToken === Token.TOKEN_END) {

                    break;

                } else if (m_curToken === Token.TOKEN_DESC) {

                    advanceToken();
                    assumeToken(Token.TOKEN_STRING);

                    description = parseStringLiteral(m_curTokenStr);
                    advanceToken();

                } else if (m_curToken === Token.TOKEN_EXPECT) {

                    advanceToken();
                    assumeToken(Token.TOKEN_IDENTIFIER);

                    expectResult = (function(token) {
                        switch (token) {
                            case 'pass': return glsShaderLibraryCase.expectResult.EXPECT_PASS;
                            case 'compile_fail': return glsShaderLibraryCase.expectResult.EXPECT_COMPILE_FAIL;
                            case 'link_fail': return glsShaderLibraryCase.expectResult.EXPECT_LINK_FAIL;
                            case 'compile_or_link_fail': return glsShaderLibraryCase.expectResult.EXPECT_COMPILE_LINK_FAIL;
                            default:
                                throw Error('invalid expected result value: ' + m_curTokenStr);
                        }
                    }(m_curTokenStr));

                    advanceToken();

                } else if (m_curToken === Token.TOKEN_VALUES) {

                /** @type {Object.<Array, number>} */ var block = glsShaderLibraryCase.genValueBlock();
                    parseValueBlock(block);
                    valueBlockList.push(block);

                } else if (
                    m_curToken === Token.TOKEN_BOTH ||
                    m_curToken === Token.TOKEN_VERTEX ||
                    m_curToken === Token.TOKEN_FRAGMENT
                ) {

                /** @type {number} */ var token = m_curToken;
                    advanceToken();
                    assumeToken(Token.TOKEN_SHADER_SOURCE);
                /** @type {string} */ var source = parseShaderSource(m_curTokenStr);

                //    console.log("old: " + m_curTokenStr);
                //    console.log("new: " + source);

                    advanceToken();
                    switch (token) {
                        case Token.TOKEN_BOTH: bothSource = source; break;
                        case Token.TOKEN_VERTEX: vertexSource = source; break;
                        case Token.TOKEN_FRAGMENT: fragmentSource = source; break;
                        default: glsShaderLibrary.de_assert(false); break;
                    }

                } else if (m_curToken === Token.TOKEN_VERSION) {

                    advanceToken();

                    /** @type {number} */ var versionNum = 0;
                    /** @type {string} */ var postfix = '';

                    assumeToken(Token.TOKEN_INT_LITERAL);
                    versionNum = parseIntLiteral(m_curTokenStr);
                    advanceToken();

                    if (m_curToken === Token.TOKEN_IDENTIFIER) {
                        postfix = m_curTokenStr;
                        advanceToken();
                    }

                    // TODO: need to fix these constants, we dont have glu
                    if (versionNum === 100 && postfix === 'es') version = '100';
                    else if (versionNum === 300 && postfix === 'es') version = '300 es';
                    else if (versionNum === 310 && postfix === 'es') version = '310 es';
                    else if (versionNum === 130) version = '130';
                    else if (versionNum === 140) version = '140';
                    else if (versionNum === 150) version = '150';
                    else if (versionNum === 330) version = '330';
                    else if (versionNum === 400) version = '400';
                    else if (versionNum === 410) version = '410';
                    else if (versionNum === 420) version = '420';
                    else if (versionNum === 430) version = '430';
                    else if (versionNum === 440) version = '440';
                    else if (versionNum === 450) version = '450';
                    else {
                        throw Error('Unknown GLSL version');
                    }

                } else {
                    throw Error('unexpected token while parsing shader case: ' + m_curTokenStr);
                }

            }

            advanceToken(Token.TOKEN_END); // case end

            /**
             * no ShaderCase yet?
             * @param {?string} vert
             * @param {?string} frag
             * @param {glsShaderLibraryCase.caseType} type
             * @return {Object}
             */
            var getShaderSpec = function(vert, frag, type) {
                return {
                /** @type {glsShaderLibraryCase.expectResult} */ expectResult: expectResult,
                /** @type {glsShaderLibraryCase.caseType} */ caseType: type,
                /** @type {Array<Object>} */ valueBlockList: valueBlockList,
                /** @type {string} */ targetVersion: version,
                /** @type {?string} */ vertexSource: vert,
                /** @type {?string} */ fragmentSource: frag
                };
            };
            getShaderSpec.bind(this);

            if (bothSource.length) {

                glsShaderLibrary.de_assert(!vertexSource);
                glsShaderLibrary.de_assert(!fragmentSource);

                shaderNodeList.push(tcuTestCase.newTest(caseName + '_vertex', description, getShaderSpec(bothSource, null,
                    glsShaderLibraryCase.caseType.CASETYPE_VERTEX_ONLY)));
                shaderNodeList.push(tcuTestCase.newTest(caseName + '_fragment', description, getShaderSpec(null, bothSource,
                    glsShaderLibraryCase.caseType.CASETYPE_FRAGMENT_ONLY)));

            } else {
                glsShaderLibrary.de_assert(vertexSource);
                glsShaderLibrary.de_assert(fragmentSource);

                shaderNodeList.push(tcuTestCase.newTest(caseName, description, getShaderSpec(vertexSource, fragmentSource,
                    glsShaderLibraryCase.caseType.CASETYPE_COMPLETE)));
                }
        };

        /**
         * @param {Array<tcuTestCase.DeqpTest>} shaderNodeList
         */
        var parseShaderGroup = function(shaderNodeList) {

            // parse 'case'
            advanceToken(Token.TOKEN_GROUP);

            /** @type {string}
             * parse case name
             */ var name = m_curTokenStr;
            advanceToken(); // \note [pyry] We don't want to check token type here (for instance to allow "uniform") group.

            // Parse description.
            assumeToken(Token.TOKEN_STRING);
            /** @type {string} */ var description = parseStringLiteral(m_curTokenStr);
            advanceToken(Token.TOKEN_STRING);

            /** @type {Array<tcuTestCase.DeqpTest>} */ var children = [];

            for (;;) {

                if (m_curToken === Token.TOKEN_END) {
                    break;
                } else if (m_curToken === Token.TOKEN_GROUP) {
                    parseShaderGroup(children);
                } else if (m_curToken === Token.TOKEN_CASE) {
                    parseShaderCase(children);
                } else {
                    testFailed('unexpected token while parsing shader group: ' + m_curTokenStr);
                    tcuTestCase.runner.terminate();
                }

            }

            advanceToken(Token.TOKEN_END); // group end

            /** @type {tcuTestCase.DeqpTest} */ var groupNode = tcuTestCase.newTest(name, description, null);
            groupNode.setChildren(children);

            shaderNodeList.push(groupNode);

        };

        // uncomment to expose private functions
        (function(obj) {
            obj.priv = {
                m_curPtr: m_curPtr,

                parseError: parseError,
                parseFloatLiteral: parseFloatLiteral,
                parseIntLiteral: parseIntLiteral,
                parseStringLiteral: parseStringLiteral,
                parseShaderSource: parseShaderSource,
                advanceTokenTester: advanceTokenTester,
                assumeToken: assumeToken,
                mapDataTypeToken: mapDataTypeToken,
                getTokenName: getTokenName,

                Token: Token,

                parseValueElement: parseValueElement,
                parseValue: parseValue,
                parseValueBlock: parseValueBlock,
                parseShaderCase: parseShaderCase,
                parseShaderGroup: parseShaderGroup,

                none: false
            };
        }(this));
        //*/
    };

/**
 * Parse the test file and execute the test cases
 * @param {string} testName Name of the test file (without extension)
 * @param {string} filter Optional filter. Common substring of the names of the tests that should be glsShaderLibrary.run.
 */
glsShaderLibrary.run = function(testName, filter) {
    WebGLTestUtils.loadTextFileAsync(testName + '.test', function(success, content) {
        if (success) {
            tcuTestCase.runner.testFile = content;
            tcuTestCase.runner.testName = testName;
            tcuTestCase.runner.runCallback(glsShaderLibrary.processTestFile);
        } else {
            testFailed('Failed to load test file: ' + testName);
            tcuTestCase.runner.terminate();
        }
    });
};

});